Fun Loops

Objective:

Build a track as shown on the picture. Get the train to loop 3 times on the inner track before it takes the outer track. Make it do a stop at the train station.

Sample Solution:

This program illustrates the use of nested loops to control the train's route decisions. Every time the train enters a split track junction, the split variable is set to 1. The inner repeat loop waits for this split track notification to set the inner track route decision (go left). After 3 split notifications are received, the inner repeat loop exits and the outer route decision (go straight) is set. The train station stop as added using a wait block. In order to get the train to stop at the train station, the delay of 4.75 seconds is determined empirically.