Prog 3: Traffic

Additions to this description added 2/27 shown with gray background.

Write a program to play the game of RushHour, such as shown on this page. Running your program should look like the following, where user input is shown in bold:

Author:  Dale Reed

Lab:     Wed 5am

Program: #3, Traffic

Welcome to the traffic game!

Move the vehicles so that the Red car (RR) can

exit the board to the right. Each move should be

of the form:   CDN   where  C  is the vehicle to

be moved,  D  is the direction (u for up, d for down,

l for left or r for right), and  N  is the number of

squares to move it.  For example GR2  means move the

G vehicle to the right 2 squares.  Lower-case input

such as   gr2   is also accepted.  Enter x to exit the

program.

- - - - - - - -

| G G . . . Y |

| P . . B . Y |

| P R R B . Y >

| P . . B . . |

| O . . . T T |

| O . F F F . |

- - - - - - - -

Your move -> gr1

- - - - - - - -

| . G G . . Y |

| P . . B . Y |

| P R R B . Y >

| P . . B . . |

| O . . . T T |

| O . F F F . |

- - - - - - - -

Your move -> 

Thank you for playing.  Exiting...

Press any key to continue . . .

Notes