diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -32,9 +32,9 @@ void initialize_colors(void) { start_color(); use_default_colors(); init_pair(EMPTY_COLOR, COLOR_BLACK, -1); + init_pair(VISITED_COLOR, COLOR_GREEN, COLOR_GREEN); init_pair(GOAL_COLOR, -1, COLOR_RED); - init_pair(WALL_COLOR, COLOR_WHITE, COLOR_WHITE); /* Using white as bg makes - them seem solid */ + init_pair(WALL_COLOR, COLOR_WHITE, COLOR_WHITE); init_pair(START_COLOR, -1, COLOR_RED); init_pair(PATH_COLOR, COLOR_RED, COLOR_RED); } @@ -52,8 +52,8 @@ int main(void) { init_ncurses(); - size_t mwidth = 20; - size_t mheight = 10; + size_t mwidth = 20; /* Maze width */ + size_t mheight = 10; /* Maze height */ Map map = rbt_maze_map(mwidth, mheight, (unsigned int) time(NULL)); Position start_pos = {0, 0}; Position end_pos = {mwidth*2-2, mheight*2-2}; @@ -65,12 +65,13 @@ int main(void) { //Position start_pos, end_pos; //Map map = file_plaintext_map("maps/test", &width, &height, &start_pos, &end_pos); //print_map_out(map, width, height); - draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL); + //draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL); - Path path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos); + char visited[height][width]; + Path path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited); while (1) { - draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, path); + draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, path, visited); char c = getch(); switch (c) { case 'h': offset_x -= 2; break; @@ -80,7 +81,7 @@ int main(void) { case 'n': //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); + path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited); break; case 'q': endwin(); return 0; } |
