-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomizer.java
More file actions
39 lines (32 loc) · 817 Bytes
/
Randomizer.java
File metadata and controls
39 lines (32 loc) · 817 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
public class Randomizer {
private int y;
private int x;
private int direction;
public Randomizer() {
y = ((int) (Math.random() * (23 - 6))) + 3;
x = ((int) (Math.random() * (23 - 6))) + 3;
direction = (int) (Math.random() * 4);
System.out.println(direction);
}
public String getDirection() {
switch (direction) {
case 0:
return "up";
case 1:
return "right";
case 2:
return "down";
case 3:
return "left";
default:
System.out.println("Direction didn't match 0-3");
return null;
}
}
public int getY() {
return y;
}
public int getX() {
return x;
}
}