Created
December 18, 2019 16:37
-
-
Save shabbychef/ca418baaf43dd8a0d38b3ce3e594d050 to your computer and use it in GitHub Desktop.
generate christmas tree maze in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(TurtleGraphics) | |
library(mazealls) | |
set.seed(1234) | |
turtle_init(900,2000,mode='clip') | |
turtle_up() | |
turtle_hide() | |
turtle_do({ | |
turtle_left(180) | |
turtle_forward(700) | |
turtle_left(90) | |
turtle_col('brown') | |
parallelogram_maze(angle=90,unit_len=12,width=20,height=18,method='uniform', | |
boundary_lines=c(2,3,4), | |
boundary_holes=c(3), | |
end_side=1, | |
draw_boundary=TRUE) | |
turtle_right(180) | |
turtle_col('green') | |
for (iii in c(1:3)) { | |
iso_trapezoid_maze(depth=5,unit_len=12,method='four_trapezoids',draw_boundary=TRUE, | |
boundary_lines=c(1,2,4), | |
boundary_holes=c(1), | |
boundary_hole_locations=c(sample(25:35,1),0,0,0), | |
end_side=3) | |
turtle_right(180) | |
} | |
eq_triangle_maze(depth=6,unit_len=12,method='stack_trapezoids',draw_boundary=TRUE, | |
boundary_lines=c(1,2,3), | |
boundary_holes=c(1,2), | |
boundary_hole_locations=c(sample(20:40,1),sample(10:50,1),0), | |
end_side=3) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment