-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpuzzle-7.js
More file actions
28 lines (24 loc) · 752 Bytes
/
Copy pathpuzzle-7.js
File metadata and controls
28 lines (24 loc) · 752 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
// 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)
{
while(getColor() != "red")
{
dir();
}
right();
right();
}
Red(down);
Red(up);
Red(down);
Red(up);
Red(down);