TRAFFIC JAM Two groups of 5 people (shown as arrows) are crossing a river in opposite directions by hopping on rocks. There are eleven rocks and in the starting configuration, the empty rock (.) is in between the two groups. > > > > > . < < < < < GOAL: The objective is for the two groups to exchange sides, that is, to pass each other. Thus, the winning configuration is: < < < < < . > > > > > RULES: 1. People can only move forward in the direction they are facing. No backstepping or turning around. 2. Only one person may move at a time. 3. There are two kinds of legal moves: A) A person may move into an adjacent empty space immediately in front of them. B) A person may move around someone (or leapfrog over them) into an empty space behind them, if they are adjacent and FACING each other. MOVING: Enter the number of the person you desire to move. Enter 0 to start over, any alphabetic key to quit. > > > > > . < < < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? |
Your move? 5 > > > > . > < < < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? |
> >
> > . >
< < < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? 6 Your move? 3 Your move? |
Screen 3: This screen shows the user has entered two illegal moves
in a row. On the current board, 6 is not legal and 3 is not
legal. The program responds by simply displaying the prompt.
(Note there is no "error" message.)
Your move? 4 > > > . > > < < < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? 7 Your move? |
Your move? 0 > > > > > . < < < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? |
Your move? 6 < < < < < . > > > > > --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 *** Hurray, you won! *** C:\TrafficJam> |
Your move? 4 > > > . < > < > < < < --- --- --- --- --- --- --- --- --- --- --- 1 2 3 4 5 6 7 8 9 10 11 Your move? q Game terminated. C:\TrafficJam> |