A2b4 fast perfekt
This commit is contained in:
parent
3d33cd4f63
commit
c681fcc2ee
Binary file not shown.
Binary file not shown.
|
@ -44,17 +44,25 @@ act
|
|||
%------------------------------------------------------------------------
|
||||
|
||||
proc
|
||||
TrafficLight(direction : CardinalDirection) = TL(direction, red);
|
||||
TrafficLight(direction : CardinalDirection) = TL(direction, red, true);
|
||||
|
||||
TL(direction : CardinalDirection, colour : Colour) =
|
||||
TL(direction : CardinalDirection, colour : Colour, firstStart : Bool) =
|
||||
(firstStart)
|
||||
-> changeDirection(direction) . ChangeLight(direction, colour)
|
||||
<>
|
||||
show(direction, colour) .
|
||||
(colour == red)
|
||||
-> (changeDirection(nextDirection(direction)) . changeDirection(direction) . ChangeLight(direction, colour))
|
||||
-> ChangeDirection(direction) . ChangeLight(direction, colour)
|
||||
<> ChangeLight(direction, colour)
|
||||
|
||||
;
|
||||
|
||||
ChangeDirection(direction : CardinalDirection) =
|
||||
changeDirection(nextDirection(direction)) . changeDirection(direction)
|
||||
;
|
||||
|
||||
ChangeLight(direction : CardinalDirection, colour : Colour) =
|
||||
changeLight(nextColour(colour)) . TL(direction, nextColour(colour))
|
||||
changeLight(nextColour(colour)) . TL(direction, nextColour(colour), false)
|
||||
;
|
||||
|
||||
System =
|
||||
|
|
Loading…
Reference in New Issue