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