-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpuzzle-8.js
More file actions
32 lines (26 loc) · 784 Bytes
/
Copy pathpuzzle-8.js
File metadata and controls
32 lines (26 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Help Rudy the Red Dot collect all the green dots!
// Control Rudy with the following commands:
// up(); -- moves Rudy up one square
// down(); -- ...down one square
// left(); -- ...left one square
// right(); -- ...right one square
// Interact with Rudy's environment using the following commands:
// remainingDots(); -- returns the number of green dots remaining
// getColor(); -- returns the color of Rudy's square
// setColor(color); -- changes the color of Rudy's square, opens gates if colors match
function Red(dir)
{
var steps = 0;
while(steps < 8)
{
dir();
steps = steps + 1;
}
right();
right();
}
Red(down);
Red(up);
Red(down);
Red(up);
Red(down);