Week 1 - A LOGO Crazy Quilt
Step One - Deciding on a Quilt Pattern
John Schroeder and I worked together on this project, and our first cooperative decision was on creating a four-patch quilt in LOGO. Here's the example we followed:
Step Two - Creating the Quilt's Boundaries
The assignment asked us to create our quilt out of blocks that are 40 pixels wide each. The full dimensions of the quilt should be 8 rows of 6 blocks (width: 240 pixels ; length: 320 pixels). With a 6 block width, we're more-so doing a six-patch quilt.
Step Three - Getting to Work
Our idea was simple: generate an alternating color-white-color six-patch pattern per row of the quilt. We began brainstorming with code. This code is in no particular order, as I've copied it from a notepad. There's some included explanation but I feel as though an in-depth look at this code would be a little unnecessary because most of it is not final and will note deliver the results you need:
To get turtle at "top left of quilt": pu lt 90 fd 120 rt 90 fd 160
To draw first square: pd repeat 4[rt 90 fd 40]
filled "red [repeat 4 [rt 90 fd 40]]
filled "random [repeat 4 [rt 90 fd 40]]
RANDOM filled blocks:
to quiltblock
pu lt 90 fd 120 rt 90 fd 160
filled "random [repeat 4 [rt 90 fd 40]]
end
clearscreen
quiltblock 2
This didn't work but it was our first attempt at trying to create a row. What's missing is a way for the turtle to move to the end of the lastblock drawn to continue drawing the next block in the sequence:
to setorigin
pu lt 90 fd 120 rt 90 fd 160|
pd
end
to randomcolor
setcolor pick [red yellow blue green violet orange]
end
to quiltrow
filled "randomcolor [repeat 4 [rt 90 fd 40]]|
end
clearscreen
setorigin
repeat 6[randomcolor quiltrow]
After that initial error and troubleshoot, we were able to fix our lack of quilting with this code (we are making each row of six in segments of 3 blocks at a time, here's one 3-block segment):
to setorigin
pu lt 90 fd 120 rt 90 fd 160
pd
end
to randomcolor
setcolor pick [red yellow blue green violet orange]
end
to quiltrow
filled "randomcolor [repeat 4 [rt 90 fd 40]]
rt 90
fd 40
filled "white [repeat 4 [fd 40 rt 90]]
pu
fd 40
pd
filled "randomcolor [repeat 4 [fd 40 rt 90]]
pu fd 40
pd
end
clearscreen
setorigin
repeat 1[randomcolor quiltrow]
First Success
The code below was our first success at generating the six-patch quilt. However, the pattern doesn't flip horizontally per each row:
to setorigin
pu lt 90 fd 120 rt 90 fd 160
pd
end
to randomcolor
setcolor pick [red yellow blue green violet orange]
end
to quiltrow1
filled "randomcolor [repeat 4 [rt 90 fd 40]]
rt 90
fd 40
filled "white [repeat 4 [fd 40 rt 90]]
pu
fd 40
pd
filled "randomcolor [repeat 4 [fd 40 rt 90]]
pu fd 40 rt -90
pd
end
to quiltrow2
filled "white [repeat 4[rt 90 fd 40]]
pu
rt 90 fd 40
pd
filled "randomcolor [repeat 4 [fd 40 rt 90]]
pu fd 40
pd
filled "white [repeat 4[fd 40 rt 90]]
end
to bottleft
pu
rt -180 fd 200
lt 90 fd 40
rt 180
pd
end
clearscreen
setorigin
repeat 8[randomcolor quiltrow1 quiltrow2 bottleft]
Final Success
We successfully completed the random quilt pattern. Here's the code:
to setorigin
pu lt 90 fd 120 rt 90 fd 160
pd
end
to randomcolor
setcolor pick [red yellow blue green violet orange]
end
to quiltrow1
filled "randomcolor [repeat 4 [rt 90 fd 40]]
rt 90
fd 40
filled "white [repeat 4 [fd 40 rt 90]]
pu
fd 40
pd
filled "randomcolor [repeat 4 [fd 40 rt 90]]
pu fd 40 rt -90
pd
end
to quiltrow2
filled "white [repeat 4[rt 90 fd 40]]
pu
rt 90 fd 40
pd
filled "randomcolor [repeat 4 [fd 40 rt 90]]
pu fd 40
pd
filled "white [repeat 4[fd 40 rt 90]]
end
to bottleft
pu
rt -180 fd 200
lt 90 fd 40
rt 180
pd
end
to flippattern1
filled "white [repeat 4[rt 90 fd 40]pu rt 90 fd 40 pd]
filled "randomcolor [repeat 4 [fd 40 rt 90]pu fd 40 pd]
filled "white [repeat 4[fd 40 rt 90]fd 40]
end
to flippattern2
filled "randomcolor [repeat 4 [fd 40 rt 90]fd 40]
filled "white [repeat 4 [fd 40 rt 90]pu fd 40 pd]
filled "randomcolor [repeat 4 [fd 40 rt 90]]
end
clearscreen
setorigin
repeat 4[randomcolor quiltrow1 quiltrow2 bottleft flippattern1 flippattern2 bottleft]
Here's some examples of our quilts:
Get Drawing, Moving and Seeing with Code - Spring 2025
Drawing, Moving and Seeing with Code - Spring 2025
Jack Fleming's work for class
Leave a comment
Log in with itch.io to leave a comment.