From 81be5d54108c8c6400ceba0ddf94e171bc27513a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 11 May 2019 16:06:05 +0900 Subject: [PATCH] Update gen-maze.ts --- src/modules/maze/gen-maze.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/maze/gen-maze.ts b/src/modules/maze/gen-maze.ts index 17fcdd6..c95441f 100644 --- a/src/modules/maze/gen-maze.ts +++ b/src/modules/maze/gen-maze.ts @@ -92,7 +92,7 @@ export function genMaze(seed, complexity?) { } const donut = rand(3) === 0; - const donutWidth = mazeSize / 3; + const donutWidth = 1 + Math.floor(mazeSize / 8) + rand(Math.floor(mazeSize / 4)); const straightMode = rand(3) === 0; const straightness = 5 + rand(10); @@ -106,7 +106,7 @@ export function genMaze(seed, complexity?) { if (donut) { for (let y = 0; y < mazeSize; y++) { for (let x = 0; x < mazeSize; x++) { - if (x >= donutWidth && x < mazeSize - donutWidth && y >= donutWidth && y < mazeSize - donutWidth) { + if (x > donutWidth && x < (mazeSize - 1) - donutWidth && y > donutWidth && y < (mazeSize - 1) - donutWidth) { maze[x][y] = 'void'; } }