Our first assignment for DMS is to create a program in LOGO that draws a randomized 8x6 tiled quilt. The first thing I did was make a procedure that moved the turtle to the top left of the screen and wrote another procedure to draw a 40x40 square to represent one tile.
to tl pu setpos [-400 240] end
to block repeat 4 [rt 90 fd 40] end
Next, I had to come up with a few different tile patterns to randomly pick from later on. I created 4 designs for my quilt:
to solid repeat 20 [bk 40 rt 90 fd 1 rt 90 bk 40 rt 90 bk 1 rt 90] end
to stripe repeat 4 [bk 40 rt 90 fd 5 rt 90 bk 40 rt 90 bk 5 rt 90] end
to half rt 135 fd 55 pu bk 55 lt 45 fd 40 lt 90 pd end
to blank rt 90 fd 40 lt 90 end
Once I had my patterns done, I attempted to create a procedure to randomly pick one to apply to the tile. My first attempt looked like this and didn't work:
to randompick pick [solid stripe half blank] end
With this in place, I would get an error saying "Don't know what to do with (pattern)". I took a break and decided I'll work on it later.
(2/3/25)
Unfortunately, I couldn't figure out how to make the procedure work with the randompick I wrote yesterday--so I caved and made it work with the following if statement:
to randompick make "pattern random 4
if :pattern=0 [solid] if :pattern=1 [stripe]
if :pattern=2 [half] if :pattern=3 [blank]
end
With this done, I created a row procedure and finished the assignment. Here is my finished code:
cs
to tl pu setpos [-400 180] end
to block repeat 4 [rt 90 fd 40] end
to solid repeat 20 [bk 40 rt 90 fd 1 rt 90 bk 40 rt 90 bk 1 rt 90] end
to stripe repeat 4 [bk 40 rt 90 fd 5 rt 90 bk 40 rt 90 bk 5 rt 90] end
to half rt 135 fd 55 pu bk 55 lt 45 fd 40 lt 90 pd end
to blank rt 90 fd 40 lt 90 end
to randompick make "pattern random 4
if :pattern=0 [solid] if :pattern=1 [stripe]
if :pattern=2 [half] if :pattern=3 [blank]
end
to row repeat 6 [block randompick] pu bk 40 lt 90 fd 240 rt 90 pd end
cs tl pd repeat 8 [row]
This was my first time using LOGO and as much as I enjoyed learning how it works, I don't think I'd like to continue using this for any of my future work. I thought this was a good exercise for getting into generative art, and I look forward to moving onto p5.js for future assignments for this class. Having used p5.js previously for generative art, I feel it's easier to work with--along with being able to do more with the language compared to LOGO.
Home