Update gen-maze.ts

This commit is contained in:
syuilo 2019-05-11 15:12:20 +09:00
parent f5644e4e13
commit 4257bbdb59
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -94,7 +94,8 @@ export function genMaze(seed, complexity?) {
const donut = rand(3) === 0; const donut = rand(3) === 0;
const donutWidth = mazeSize / 3; const donutWidth = mazeSize / 3;
const straightMode = rand(10) === 0; const straightMode = rand(3) === 0;
const straightness = 5 + rand(10);
// maze (filled by 'empty') // maze (filled by 'empty')
const maze: CellType[][] = new Array(mazeSize); const maze: CellType[][] = new Array(mazeSize);
@ -147,7 +148,7 @@ export function genMaze(seed, complexity?) {
if (isLeftDiggable) dirs.push('left'); if (isLeftDiggable) dirs.push('left');
let dir: Dir; let dir: Dir;
if (straightMode) { if (straightMode && rand(straightness) !== 0) {
if (dirs.includes(prevDir)) { if (dirs.includes(prevDir)) {
dir = prevDir; dir = prevDir;
} else { } else {