set Moves = {north,south,east,west}

/** Concurrency: State Models and Java Programs
 *             Jeff Magee and Jeff Kramer
 *  
 */

MAZE(Start=8) = (init[Start]->start->P[Start]),
P[0] = (north->exit->STOP|east->P[1]),
P[1] = (east ->P[2]|south->P[4]|west->P[0]),
P[2] = (south->P[5]|west ->P[1]),
P[3] = (east ->P[4]|south->P[6]),
P[4] = (north->P[1]|west ->P[3]),
P[5] = (north->P[2]|south->P[8]),
P[6] = (north->P[3]),
P[7] = (east ->P[8]),
P[8] = (north->P[5]|west->P[7]).

MOVING = ({north,south,east,west}->endMove->MOVING).

||GETOUT = (MOVING ||MAZE(6)).


animation MAZE = "xml/maze.xml"
                 actions {
					init[i:0..8]/init[i],
                    init[0..8]/clear,
                    forall[i:Moves] {[i]/[i]}
                 }
                 controls {
                    endMove/end,
                    forall[i:Moves] {[i]/[i]}
                 }

animation REPLAY = "xml/maze.xml"
                 actions {
					init[i:0..8]/init[i],
                    forall[i:Moves] {[i]/[i]}
                 }
                 controls {
                    endMove/end,
					start/start
                 }

