diff options
Diffstat (limited to 'src/maze.c')
-rw-r--r-- | src/maze.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,10 +1,10 @@ #include "maze.h" #include "grid.h" #include "position.h" +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdint.h> int is_pos_empty(Grid grid, Position pos) { @@ -15,10 +15,10 @@ void add_neighbour(Position neighbours[], uint8_t *neighbour_cnt, Position neigh { neighbours[*neighbour_cnt] = neighbour_pos; (*neighbour_cnt)++; - } -void get_neighbours(Grid grid, Position pos, Position neighbours[], uint8_t *neighbour_cnt) +void get_neighbours(Grid grid, Position pos, Position neighbours[], + uint8_t *neighbour_cnt) { if (pos.y != 1) { @@ -96,7 +96,7 @@ void grid_to_maze(Grid grid, Position start_pos) Position next_pos = neighbours[rand() % neighbour_cnt]; Position between_pos = position_create(pos.x, pos.y); - + if (next_pos.y != pos.y) between_pos.y += next_pos.y > pos.y ? 1 : -1; @@ -110,4 +110,3 @@ void grid_to_maze(Grid grid, Position start_pos) pos_stack_destroy(path); } - |