// Driver.java -- driver file for chess program -- doesn't play game but // rather finds destinations for chess pieces // not fully implemented... only does rook and knight import java.io.*; import java.util.*; public class Driver { public static void main(String [] args) throws IOException { BufferedReader kbd = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Welcome to the Chess Moves program. This program \n "+ "will find the legal destinations of a chess piece.\n" + "Which chess piece do you want to move? " + "(e.g. k for knight) "); char choice = kbd.readLine().charAt(0); System.out.print("Please enter current row and column: "); String coordinates = kbd.readLine(); StringTokenizer tok = new StringTokenizer(coordinates, ", "); int row = Integer.parseInt(tok.nextToken()); int col = Integer.parseInt(tok.nextToken()); // create a new chess piece Piece p = new Piece(choice, row, col); ///////////////////////////////////////////////////////////////// // output ///////////////////////////////////////////////////////////////// System.out.println("\nYour possible destinations are as follows:"); if (choice == 'R' || choice == 'r') p.findRookMoves(); else if (choice == 'K' || choice == 'k') p.findKnightMoves(); else System.out.println("Sorry, that piece hasn't been implemented yet."); } }