-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathTreasureHuntDriver.java
More file actions
43 lines (37 loc) · 1.03 KB
/
Copy pathTreasureHuntDriver.java
File metadata and controls
43 lines (37 loc) · 1.03 KB
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
/**
@Author:
Date:
Teacher: Appel
*/
import kareltherobot.*;
import java.awt.Color;
import java.util.Random;
public class TreasureHuntDriver implements Directions
{
public static void main(String args[]) {
//Your code goes below here:
TreasureBot karel = new TreasureBot(2, 2, North, 0);
karel.findTreasure();
karel.turnOff();
}
static {
int world = (int)(Math.random()*3+1);
World.reset();
World.setSize(10, 10);
if (world == 1) {
World.readWorld("worlds/treasure1.kwld");
}
else if (world == 2){
World.readWorld("worlds/treasure2.kwld");
}
else if (world == 3) {
World.readWorld("worlds/treasure3.kwld");
}
//World.readWorld("worlds/fig6-27.kwld");
World.setBeeperColor(Color.black);
World.setStreetColor(Color.gray);
World.setNeutroniumColor(Color.black);
World.setDelay(10);
World.setVisible(true);
}
}