Answer Key: Repeating Behaviors_Unit Level

Answer Key: Unit Quiz

  1. When the program beam reaches the Loop block, it either loops forever or check the Condition set by the block parameters ( time, sensor, logic).  If the Condition is not met (or the Loop is set for “forever”) the program returns to the beginning of the Loop and runs the contents of the Loop again.  If the Condition is met, the program exits the Loop and runs the next block in the program.
  2. The Loop block only checks its Condition at the moment when the program reaches the Loop block.  If there are blocks inside the Loop that take significant amounts of time (“Wait-for” or “Move” blocks set for large durations) then the loop Condition may not be checked very often.  If there are only quick blocks inside the Loop (“Move” blocks set for unlimited or stop) then the Loop Condition will be checked frequently (up to hundreds of times per second).
  3. The program had large duration Move blocks inside the Ultrasonic Sensor-Controlled Loop.  Each of these Move commands had to be completed before the sensor could be checked again.  Only if the obstacle was present when the Loop block was checked (at the end of the turn) did the tribot detect the obstacle and stop.
  4. 1) The forward Move blocks need to be changed from unlimited duration to a fixed duration (and the two durations would need to be different since this is a rectangle, not a square)
    2) The two turning Move blocks need to turn in the same direction
    3) The Loop block count should be set at 2, since Ziffle wants one lap of a rectangle (and the Move blocks inside the Loop create an “L” shape).
  5. Ziffle’s tribot will only stop for an obstacle that is 10 cm away after the “right turn”, since this is the only point in the program when the Loop block checks for an obstacle.  If the obstacle is placed in front of the tribot anywhere else in the zig-zag maneuver, it will be ignored and the tribot will not stop.