A2b4 fast perfekt

This commit is contained in:
Johannes Theiner 2020-05-10 10:19:29 +02:00
parent 3d33cd4f63
commit c681fcc2ee
3 changed files with 15 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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 =