From 4257bbdb59e5c83f9bdbf1932635bbb456a335d1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 11 May 2019 15:12:20 +0900 Subject: [PATCH] Update gen-maze.ts --- src/modules/maze/gen-maze.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/maze/gen-maze.ts b/src/modules/maze/gen-maze.ts index a9baec7..17fcdd6 100644 --- a/src/modules/maze/gen-maze.ts +++ b/src/modules/maze/gen-maze.ts @@ -94,7 +94,8 @@ export function genMaze(seed, complexity?) { const donut = rand(3) === 0; const donutWidth = mazeSize / 3; - const straightMode = rand(10) === 0; + const straightMode = rand(3) === 0; + const straightness = 5 + rand(10); // maze (filled by 'empty') const maze: CellType[][] = new Array(mazeSize); @@ -147,7 +148,7 @@ export function genMaze(seed, complexity?) { if (isLeftDiggable) dirs.push('left'); let dir: Dir; - if (straightMode) { + if (straightMode && rand(straightness) !== 0) { if (dirs.includes(prevDir)) { dir = prevDir; } else {