package dancinggooglers;

import java.io.File;
import java.util.Scanner;

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

package jp.funnything.competition.util;

public enum Direction {
    UP , DOWN , LEFT , RIGHT;

    public int dx() {
        switch ( this ) {
        case UP:
        case DOWN:
            return 0;
        case LEFT:
            return -1;
        case RIGHT:
            return 1;
        default:
            throw new RuntimeException( "assert" );
        }
    }

    public int dy() {
        switch ( this ) {
        case UP:
            return -1;
        case DOWN:
            return 1;
        case LEFT:
        case RIGHT:
            return 0;
        default:
            throw new RuntimeException( "assert" );
        }
    }

    public Direction reverese() {
        switch ( this ) {
        case UP:
            return DOWN;
        case DOWN:
            return UP;
        case LEFT:
            return RIGHT;
        case RIGHT:
            return LEFT;
        default:
            throw new RuntimeException( "assert" );
        }
    }

    public Direction turnLeft() {
        switch ( this ) {
        case UP:
            return LEFT;
        case DOWN:
            return RIGHT;
        case LEFT:
            return DOWN;
        case RIGHT:
            return UP;
        default:
            throw new RuntimeException( "assert" );
        }
    }

    public Direction turnRight() {
        switch ( this ) {
        case UP:
            return RIGHT;
        case DOWN:
            return LEFT;
        case LEFT:
            return UP;
        case RIGHT:
            return DOWN;
        default:
            throw new RuntimeException( "assert" );
        }
    }
}
