board_x = 5; board_y = 5; board_z = 0; board_length = 300; board_width = 300; board_height = 20; cell_size = board_length / 10;// it's equal to car width/length(will be fine if car be quadrat) quadrants = [ // Part 1 [board_x+cell_size, board_y+cell_size], // Part 2 [board_x+cell_size + board_length/2, board_y+cell_size], // Part 3 [board_x+cell_size, board_y+cell_size + board_width/2], // Part 4 [board_x+cell_size + board_length/2, board_y+cell_size + board_width/2] ]; for (q = quadrants) { q_start_x = q[0]; q_start_y = q[1]; q_end_x = q_start_x + board_length/2 - cell_size; q_end_y = q_start_y + board_width/2 - cell_size; echo(str("Drawing maze in quadrant starting at: ", q_start_x, ",", q_start_y)); // We step by 'cell_size' for (x = [q_start_x : cell_size : q_end_x - cell_size]) { for (y = [q_start_y : cell_size : q_end_y - cell_size]) { translate([x, y, 0]) { // For example: a random wall or a pillar draw_maze_cell(cell_size); } } } } module board(x, y, z, length, width, height) { difference() { translate([x, y, z]) color("#472d02ad") cube([length, width, height]); translate([x+1, y+1, z+4]) color("orange") cube([length-2, width-2, height]); }; } module draw_maze_cell(size) { // random wall if (rands(0, 10, 1)[0] > 5) { color("red") cube([size, 2, board_height - 10]); // horizontal wall } else { color("red") cube([2, size, board_height - 10]); // vertical wall } } module set_board_nets(x, y, z, length, width, height) { for(i = [board_x + cell_size : cell_size/2 : (board_length)]) { for(j = [board_y + cell_size : cell_size/2 : board_width]){ translate([i, j, 2]) cube([2, 2, 3]); } } } difference() { board(board_x, board_y, board_z, board_length+2, board_width+2, board_height); set_board_nets(board_x+2, board_y, board_z-1, board_length+ 2, board_width+2, board_height); }