2024-11-15 20:20:10 +00:00
|
|
|
let cell_size = 10
|
|
|
|
let slash_length = mult(cell_size, sqrt(2))
|
|
|
|
let cols = 20
|
|
|
|
let rows = 4
|
2024-06-11 21:55:57 +00:00
|
|
|
|
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
penwidth!(3)
|
2024-06-11 21:55:57 +00:00
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
fn forward_slash! () -> {
|
|
|
|
pd!()
|
|
|
|
rt!(0.125)
|
|
|
|
fd!(slash_length)
|
|
|
|
pu!()
|
|
|
|
bk!(slash_length)
|
|
|
|
lt!(0.125)
|
2024-06-11 21:55:57 +00:00
|
|
|
}
|
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
fn back_slash! () -> {
|
|
|
|
pu!()
|
|
|
|
fd!(cell_size)
|
|
|
|
pd!()
|
|
|
|
rt!(0.375)
|
|
|
|
fd!(slash_length)
|
|
|
|
pu!()
|
|
|
|
lt!(0.125)
|
|
|
|
bk!(cell_size)
|
|
|
|
lt!(0.25)
|
2024-06-11 21:55:57 +00:00
|
|
|
}
|
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
fn next_cell! () -> {
|
|
|
|
pu!()
|
|
|
|
rt!(0.25)
|
|
|
|
fd!(cell_size)
|
|
|
|
lt!(0.25)
|
2024-06-11 21:55:57 +00:00
|
|
|
}
|
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
repeat rows {
|
|
|
|
repeat cols {
|
|
|
|
if random([true, false])
|
|
|
|
then forward_slash!()
|
|
|
|
else back_slash!()
|
2024-06-11 21:55:57 +00:00
|
|
|
|
2024-11-15 20:20:10 +00:00
|
|
|
next_cell!()
|
2024-06-11 21:55:57 +00:00
|
|
|
}
|
2024-11-15 20:20:10 +00:00
|
|
|
lt!(0.25)
|
|
|
|
fd!(mult(cols, cell_size))
|
|
|
|
rt!(0.25)
|
|
|
|
back!(cell_size)
|
|
|
|
}
|