mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 13:31:30 +02:00
refactor: use %
This commit is contained in:
@@ -53,13 +53,13 @@ function rand_dirs(c, seed) =
|
|||||||
_next_x_table = [1, 0, -1, 0];
|
_next_x_table = [1, 0, -1, 0];
|
||||||
function next_x(x, dir, columns, wrapping) =
|
function next_x(x, dir, columns, wrapping) =
|
||||||
let(nx = x + _next_x_table[dir])
|
let(nx = x + _next_x_table[dir])
|
||||||
wrapping ? (nx < 0 ? nx + columns : nx % columns) : nx;
|
wrapping ? (nx + columns) % columns : nx;
|
||||||
|
|
||||||
// get y value by dir
|
// get y value by dir
|
||||||
_next_y_table = [0, 1, 0, -1];
|
_next_y_table = [0, 1, 0, -1];
|
||||||
function next_y(y, dir, rows, wrapping) =
|
function next_y(y, dir, rows, wrapping) =
|
||||||
let(ny = y + _next_y_table[dir])
|
let(ny = y + _next_y_table[dir])
|
||||||
wrapping ? (ny < 0 ? ny + rows : ny % rows) : ny;
|
wrapping ? (ny + rows) % rows : ny;
|
||||||
|
|
||||||
// go right and carve the right wall
|
// go right and carve the right wall
|
||||||
function carve_right(x, y, cells) =
|
function carve_right(x, y, cells) =
|
||||||
|
Reference in New Issue
Block a user