mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 05:08:00 +00:00
Update gen-maze.ts
This commit is contained in:
parent
f5644e4e13
commit
4257bbdb59
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue