Question:

7:25 7 .. ovojo The following program moves a robot in a grid of squares. The initial position and direction of the robot is sho

7:25 7
..
ovojo
The following program moves a robot in a
grid of squares. The initial position and
direction of the robot is shown below.
Click on the grid to move the robot to the
final position after the program is run.
You must click within the box to
rotate the robot to the correct final
direction (click near the top of the box to
rotate up, etc...) Feel free to move the
robot along as you follow the code.
reset robot
1
i
3
2
ROTATE_RIGHT()
REPEAT 2 TIMES
3
4
{
5
6
7
8
9
10
11
12
MOVE_FORWARD
MOVE_FORWARD
if i = 2 )
{
MOVE_FORWARD )
}
else
{
if i 23 )
{
MOVE FORWARD )
}
}
ROTATE_LEFT()
i i - 1
13
14
15
16
17
18
19
20
}
21
deltamath.com

7:25 7 .. ovojo The following program moves a robot in a grid of squares. The initial position and direction of the robot is shown below. Click on the grid to move the robot to the final position after the program is run. You must click within the box to rotate the robot to the correct final direction (click near the top of the box to rotate up, etc...) Feel free to move the robot along as you follow the code. reset robot 1 i 3 2 ROTATE_RIGHT() REPEAT 2 TIMES 3 4 { 5 6 7 8 9 10 11 12 MOVE_FORWARD MOVE_FORWARD if i = 2 ) { MOVE_FORWARD ) } else { if i 23 ) { MOVE FORWARD ) } } ROTATE_LEFT() i i - 1 13 14 15 16 17 18 19 20 } 21 deltamath.com

More Questions on Iterations & Loops

View all