-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.pde
77 lines (73 loc) · 1.32 KB
/
main.pde
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import g4p_controls.*;
Mouse mouse;
Cell[][] cells;
Maze maze;
Walls[] walls;
final float pi = 3.14;
final float two_pi= 6.28;
boolean runFlag=false;
boolean backFlag=false;
ArrayList<Path> path= new ArrayList<Path>();
ArrayList<Backpath> backpath= new ArrayList<Backpath>();
void setup() {
size(700, 700);
createGUI();
customGUI();
mouse = new Mouse();
maze = new Maze();
cells = new Cell[16][16];
walls = new Walls[544];
for (int i=0; i<16; i++) {
for (int j=0; j<16; j++) {
cells[i][j]=new Cell(20+(40*i), 20+(40*j));
}
}
for (int i=0; i<544; i++) {
walls[i]=new Walls(0, 0, 0, 0);
}
setValue();
}
void draw() {
for (int i=0; i<16; i++) {
for (int j=0; j<16; j++) {
cells[i][j].render();
cells[i][j].showValue();
}
}
mouse.render();
maze.render();
maze.update();
if (runFlag==true) {
mouse.senseWall();
//runFlag=false;
}
if(backFlag==true){
mouse.backHome();
//backFlag=false;
}
}
void setValue() {
int r=14;
for (int i=0; i<16; i++) {
int c=r;
for (int j=0; j<16; j++) {
cells[i][j].value=c;
if (j>6) {
if (j==7)
continue;
c++;
} else {
c--;
}
}
if (i>=7) {
if (i==7)
continue;
r++;
} else {
r--;
}
}
}
public void customGUI() {
}