2022-06-06 13:11:46 +08:00
|
|
|
use <util/rand.scad>
|
|
|
|
use <experimental/tile_w2e.scad>
|
|
|
|
use <select.scad>
|
|
|
|
use <city_tile.scad>
|
2021-01-23 22:51:07 +08:00
|
|
|
|
2021-01-24 09:51:27 +08:00
|
|
|
mask = [
|
|
|
|
[0, 1, 1, 0, 0, 0, 1, 1, 0],
|
|
|
|
[1, 1, 1, 1, 0, 1, 1, 1, 1],
|
|
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
|
|
[0, 1, 1, 1, 1, 1, 1, 1, 0],
|
|
|
|
[0, 0, 1, 1, 1, 1, 1, 0, 0],
|
|
|
|
[0, 0, 0, 1, 1, 1, 0, 0, 0]
|
|
|
|
];
|
2021-01-23 22:51:07 +08:00
|
|
|
|
2021-01-24 09:51:27 +08:00
|
|
|
rows = len(mask);
|
|
|
|
columns = len(mask[0]);
|
2021-01-23 22:51:07 +08:00
|
|
|
|
2021-01-24 09:51:27 +08:00
|
|
|
random_city(rows, columns, mask);
|
|
|
|
|
|
|
|
module random_city(rows, columns, mask) {
|
2021-01-23 22:51:07 +08:00
|
|
|
tile_width = 30;
|
2021-07-30 11:43:31 +08:00
|
|
|
for(tile = tile_w2e([columns, rows], mask)) {
|
2021-12-27 09:20:43 +08:00
|
|
|
translate([tile.x, tile.y] * tile_width)
|
|
|
|
city_tile(tile[2], tile_width);
|
2021-01-23 22:51:07 +08:00
|
|
|
}
|
|
|
|
}
|