Skip to content

Instantly share code, notes, and snippets.

@ecarlisle
Created January 18, 2021 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecarlisle/1a289b26f5bf37548ee12d6b4476642b to your computer and use it in GitHub Desktop.
Save ecarlisle/1a289b26f5bf37548ee12d6b4476642b to your computer and use it in GitHub Desktop.
const rowWidth = 10;
const rows = [
[50, 40, 30, 30, 50],
[20, 50, 60, 40, 30],
[40, 40, 30, 40, 50],
[30, 60, 30, 40, 40],
[20, 40, 50, 60, 30],
[50, 40, 30, 30, 50],
[20, 50, 60, 40, 30],
[40, 40, 30, 40, 50],
[30, 60, 30, 40, 40],
[20, 40, 50, 60, 30],
[50, 40, 30, 30, 50],
[20, 50, 60, 40, 30],
[40, 40, 30, 40, 50],
[30, 60, 30, 40, 40],
[20, 40, 50, 60, 30],
[50, 40, 30, 30, 50],
[20, 50, 60, 40, 30],
[40, 40, 30, 40, 50],
[30, 60, 30, 40, 40],
[20, 40, 50, 60, 30],
];
function makeBoard(tx, ty, l) {
let board = cube({size: [rowWidth-1, l-1, 1.2], center: false});
return translate([tx, ty, 0], board);
}
function makeFloor() {
let x = 0;
let y = 0;
let floor = [];
for (let i = 0; i < rows.length; i++) {
y = 0;
for (let j=0; j < rows[i].length; j++) {
floor.push(makeBoard(i * rowWidth, y, rows[i][j]));
y = y + rows[i][j];
}
}
floor.push(cube({size: [200, 199, 0.4], center: false}))
return floor;
}
function main () {
return union(makeFloor())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment