From 4ae37809d0739ea3f68d3c636c42ca2be97b9c1c Mon Sep 17 00:00:00 2001 From: The Dod Date: Sat, 15 Jan 2022 15:19:57 +0200 Subject: [PATCH] Cover an edge case [probably very rare, but still] --- apps/acmaze/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/acmaze/app.js b/apps/acmaze/app.js index bc5fad9cf..3f8a6d820 100644 --- a/apps/acmaze/app.js +++ b/apps/acmaze/app.js @@ -63,7 +63,7 @@ function Maze(n) { from_group = to_group = -1; while (from_group<0) { let trying_down = false; - if (Math.random()<0.5 || !candidates_right.length) { + if (Math.random()<0.5 && candidates_down.length || !candidates_right.length) { trying_down = true; } let candidates = trying_down ? candidates_down : candidates_right;