The game of Rush Hour is played in a 6x6 grid. The goal is to drive your vehicle out of the maze as quickly as possible. You may move each vehicle one square at a time, but only in the direction (up-down or left-right) that is oriented. You may not move two vehicles into the same square.
Input
Your program should read input via standard in (cin with C++ or System.in for Java). The board will be represented as a matrix. A blank square will contain a "." and a square that is occupied by a vehicle will contain a lower-case letter. Each vehicle will be denoted with a unique lower-case letter. Your vehicle will be denoted with the letter ‘x’. All squares occupied by that vehicle will be denoted with that letter. The exit will always be at the rightmost side of the third row.
For example, the board above would be represented by:
aa...o
p..q.o
pxxq.o
p..q..
b...cc
b.rrr.
Output
Your program should only produce the output listed below. (There should be no extraneous output, e.g. a prompt like “Enter the board:”.) If a puzzle is not solvable, there should be a single line of output with the number “-1”. Otherwise, on the first line of output should be an integer n, representing the minimum number of moves required to solve the puzzle. Followed by this line, there should be a list of n moves
needed to solve the puzzle with one line for each move required. Each move should begin with the letter of the vehicle being moved, followed by a space, followed by a character indicating the direction (‘u’, ‘d’, ‘l’, or ‘r’ for up, down, left, or right respectively.) Note that you may only move a vehicle one square at a time. The problem is considered solved when your vehicle is immediately adjacent to the exit. For example, the puzzle in the input could be solved by:
16
a r
p u
b u
r l
r l
c l
c l
c l
q d
q d
o d
o d
o d
x r
x r
x r
Sequence of Moves Needed to Solve Test Input – Note that if a vehicle moves in same direction consecutively, only the final position for the consecutive moves is depicted.
Can someone please point me to right direction how to start this project. I am only asking for help on startup and not for the solution of whole thing so I think this does not violate any ethics rules or anything.
In advance Thank You for the help.
pdf file with graphical version can be found at : https://www.dropbox.com/s/29jylsjyh8hevr0/Traffic%20Jam.pdf