diff --git a/src/route.c b/src/route.c index 09cc7cc..76877c0 100644 --- a/src/route.c +++ b/src/route.c @@ -203,8 +203,12 @@ void generate(route *rt) { directions *dirs = init_directions(rt); - for (int i=0; i < RANDINT(1, rt->width*rt->width) && evaluate_directions(dirs); i++) + for (int i=0; i < RANDINT(1, rt->width*rt->width); i++) { + if (!evaluate_directions(dirs)) + { + break; + } push_choose(rt, dirs); } -} \ No newline at end of file +}