-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpuzzle-6.js
More file actions
48 lines (41 loc) · 875 Bytes
/
Copy pathpuzzle-6.js
File metadata and controls
48 lines (41 loc) · 875 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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 UD()
{
if(getColor()=="blue")
{
down();
down();
down();
}
else
{
up();
up();
up();
}
}
function LR()
{
if(getColor()=="blue")
{
right();
}
else
{
left();
}
}
right();
UD();
LR();
down();
up();