color background_color = color (80, 80, 220);
color runner = color (255, 50, 50);
color visited_color = color(220, 240, 240);
color done_color = color (100, 160, 250);
ArrayList<Cell> done = new ArrayList<Cell>();
ArrayList<Cell> visit = new ArrayList<Cell>();
c_size = max(width/g_size, height/g_size);
cell = new Cell[g_size][g_size];
for (int i = 0; i < g_size; i++) {
for (int j = 0; j < g_size; j++) {
cell[i][j] = new Cell(i, j);
for (int i = 0; i < g_size; i++) {
for (int j = 0; j < g_size; j++) {
cell[i][j].add_neighbor();
background(background_color);
for (int i = 0; i < g_size; i++) {
for (int j = 0; j < g_size; j++) {
if (visit.size() < g_size*g_size) {
if (run_cell.check_sides()) {
Cell chosen = run_cell.pick_neighbor();
if (chosen.i - run_cell.i == 1) {
run_cell.wall[1] = false;
} else if (chosen.i - run_cell.i == -1) {
run_cell.wall[3] = false;
} else if (chosen.j - run_cell.j == 1) {
run_cell.wall[2] = false;
run_cell.wall[0] = false;
run_cell.current = false;
} else if (done.size()>0) {
run_cell.current = false;
run_cell = done.remove(done.size()-1);
run_cell.stacked = false;