diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-22 13:40:21 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-22 13:40:21 +0300 |
| commit | 5b13d9bfa2b14c1231c5b19a9ccffb2d308112e4 (patch) | |
| tree | 635da16ef4652c7b3f06108d8069869940ef52a4 /main.c | |
| parent | 18acaac228db4b67acd375b6e5989dfbe71e8f2e (diff) | |
Implement 8dir breadth-first-search and some other stuff
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -37,6 +37,8 @@ void initialize_colors(void) { init_pair(WALL_COLOR, COLOR_WHITE, COLOR_WHITE); init_pair(START_COLOR, -1, COLOR_RED); init_pair(PATH_COLOR, COLOR_RED, COLOR_RED); + init_pair(FRONTIER_COLOR, COLOR_BLUE, COLOR_BLUE); + init_pair(CURSOR_COLOR, -1, COLOR_RED); } void init_ncurses(void) { @@ -78,13 +80,14 @@ int main(int argc, char **argv) { int offset_x = 0, offset_y = 0; - draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, NULL); + draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, NULL, NULL, NULL); + //print_map_out(map, width, height); char visited[height][width]; - Path path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited); + Path path = breadth_first_search_path_8dir(map, width, height, start_pos, end_pos, visited, 1); while (1) { - draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, path, visited); + draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, path, visited, NULL); char c = getch(); switch (c) { case 'h': offset_x -= 2; break; @@ -95,7 +98,7 @@ int main(int argc, char **argv) { if (is_maze) { //FIXME: free it all before generating a new one map = rbt_maze_map(mwidth, mheight, (unsigned int) time(NULL)); - path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited); + path = breadth_first_search_path_8dir(map, width, height, start_pos, end_pos, visited, 1); } break; case 'q': endwin(); return 0; |
