rushhour
Class RushHour
java.lang.Object
rushhour.RushHour
public class RushHour
- extends java.lang.Object
This class reads in a Rush Hour game from input files specified in the
dataFiles array. Input files should be formatted in the following manner:
-The first line contains a positive integer which represents the number
of vehicles that will be added to the game board.
-That number of vehicles should then follow in the input file.
-Each vehicle must contain a 1) type (car or truck), 2) color,
3) orientation (h or v), 4) y-coordinate (1-boardHeight),
5) x-coordinate (1-boardWidth). Each of these characteristics must be on
a separate line.
The game board is created and each vehicle specified in the input file is
added to the board. No two vehicles can have the same color. Once the board
is successfully constructed, the solve() method on the game board is called
to optimally find a solution to the given game board in the minimum number of
moves.
If no solution is found, false is returned from solve() and this class will
respond accordingly, outputting failure to the console. If a solution is
found, the initial game board, a list of moves required to solve minimally,
and the winning game board will be displayed. If specified, this class will
output a visual representation of the game board after each move. To specify
this visual representation, pass true instead of false into the
outputSolution() method.
|
Method Summary |
static void |
main(java.lang.String[] args)
Responsible for executing the application, then immedietly calls the
non-static run(). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RushHour
public RushHour()
main
public static void main(java.lang.String[] args)
- Responsible for executing the application, then immedietly calls the
non-static run().
- Parameters:
args - The command-line arguments.