Pause for longer while solving

This commit is contained in:
Camden Dixie O'Brien 2024-11-04 20:44:20 +00:00
parent ebbaac7db9
commit bb44747770

7
main.c
View File

@ -39,7 +39,8 @@ typedef struct {
bool visited : 1; bool visited : 1;
} cell_t; } cell_t;
static const struct timespec wait = { .tv_nsec = 5000000 }; static const struct timespec gen_pause = { .tv_nsec = 5000000 };
static const struct timespec solve_pause = { .tv_nsec = 10000000 };
static const vec2_t steps[] = { static const vec2_t steps[] = {
[LEFT] = { .x = -2, .y = 0 }, [LEFT] = { .x = -2, .y = 0 },
@ -115,7 +116,7 @@ static bool generation_visit(vec2_t c, vec2_t im)
maze[im.x][im.y].is_path = true; maze[im.x][im.y].is_path = true;
clear_path(im); clear_path(im);
clear_path(c); clear_path(c);
nanosleep(&wait, NULL); nanosleep(&gen_pause, NULL);
return false; return false;
} }
@ -130,7 +131,7 @@ static bool solve_visit(vec2_t c, vec2_t im)
maze[im.x][im.y].visited = true; maze[im.x][im.y].visited = true;
draw_visited(im); draw_visited(im);
draw_visited(c); draw_visited(c);
nanosleep(&wait, NULL); nanosleep(&solve_pause, NULL);
return GOAL == c.x && GOAL == c.y; return GOAL == c.x && GOAL == c.y;
} }