Quilting 2.0






Starting anew (kind of), I realized the better way to go about this would probably be to make a set of functions that generate both the box and the icon within the box, then all i'd have to do is create a function that creates the boxes at the right starting location but with the type of icon/function randomly called somehow.
To start I want to decide on box size/spacing. For a quilt with 8 rows of 6 I want to use squares with a bit of larger border on the left and right sides of the screen so it looks like a quilt hanging vertically.
I previously discovered the default screen size in the logo interpreter is 1093 x 736. To create the sizing I wanted I found that block size of 65x65 worked nicely.
Code generate the "empty quilt" is as follows:
cs
penup
setpos [-336.5 358]
to row
repeat 6 [
repeat 4 [pendown fd -65 lt 90] ; Draw a square
penup
rt 90 fd 80.5 lt 90 ; Move to the next position
pendown
]
end
to blocks :times
repeat :times [
setpos list -236.5 (435 - (80 * repcount)) ;
pendown
row
penup
]
end
blocks 8
Next, I opened a new tab of the LOGO interpreter and had some fun making some designs within 65x65 blocks.
It took a while to get the logic to work with the start and stop places of each block or "Deco" as I have called them in my quilt work.
I then passed the multiple kinds of Deco into the function used to draw individual squares with "to DECO :Type" and then had a random number generated for each time the DECO function was called.
Working in LOGO has made me really appreciate all of the time I have spent in other programs, while so much was intuitive so much was also more difficult. I wanted to get more advanced with my decorations for each patch on the quilt but, didn't go as deep as I initially wanted. Even still the final product is really quite fun, it's so cool to see all of the randomly generated combinations.
My final code is as follows so you can see it work in Logo Interpreter:
cs
to randomcolor
setcolor pick [purple green blue violet brown red salmon orange aqua]
end
to deco :type
if :type = 1 [
repeat 4 [pendown fd -65 lt 90]
penup
right 90 fd 32.5
rt 110
fd 15
pendown
fd 10
rt 90
fd 10
lt 120
fd 15
rt 35
fd 13
lt 90
fd 5
lt 75
fd 15
rt 90
fd 17
lt 140
fd 12
rt 45
fd 13
lt 120
fd 8
rt 45
fd 13
fill
repeat 2 [randomcolor
repeat 3 [
randomcolor
penup
rt 15
fd 10
pendown
fd 5
bk 2.5
rt 90 fd 2.5 bk 5
]
penup
left 90 fd 30
left 90 fd 13
pendown
penup
]
rt 130
fd 35
lt 90
fd 10
rt 90
]
if :type = 2 [randomcolor repeat 4 [randomcolor pendown fd -65 lt 90 ] repeat 2 [randomcolor right 90 fd 13 right 90 fd 65 lt 90 fd 13 lt 90 fd 65 right 90 fd 13 right 90 fd 65 lt 90 fd 13 lt 90 fd 65 rt 90 fd 13 rt 90 fd 65
right 90 fd 65 rt 90 fd 13 rt 90 fd 65 lt 90 fd 13 lt 90 fd 65 rt 90 fd 13 rt 90 fd 65 lt 90 fd 13 lt 90 fd 65 penup right 90 fd 5 ]fd 15]
if :type = 3[repeat 4 [pendown fd -65 lt 90 ]
repeat 5 [right 90 fd 6 right 90 fd 65 lt 90 fd 6 lt 90 fd 65 ] penup
lt 90 fd 60
rt 90]
if :type = 4[repeat 4 [randomcolor pendown fd -65 lt 90] rt 90
rt 90 fd 13 lt 90 fd 65 rt 90 fd 13 rt 90 fd 65 lt 90 fd 13 lt 90 fd 65 rt 90 fd 13 rt 90 fd 65 right 90 fd 52]
if :type = 5[repeat 4 [pendown fd -65 lt 90] rt 135 fd 92 lt 152 fd 68 penup lt 73 fd 4 rt 90 lt 90 fd 40 rt 90]
if :type = 6[repeat 4 [pendown fd -65 lt 90 ] right 90 fd 32.5 rt 90 fd 65 right 180 fd 21.66 right 90 fd 32.5 lt 90 fd 43.34 lt 90 fd 65 rt 90]
end
to row
repeat 6 [randomcolor
deco (1 + random 6)
penup
rt 90 fd 80.5 lt 90
pendown
]
end
to blocks :times
repeat :times [
setpos list -236.5 (435 - (80 * repcount))
pendown
row
penup
]
end
hideturtle
blocks 8
DSMC (Spring 2025)
Status | In development |
Category | Other |
Author | Paul |
More posts
- Classes/Objects/Vectoring (week 3)1 day ago
- icebergs (week 2)10 days ago
- Quilting...17 days ago
Leave a comment
Log in with itch.io to leave a comment.