Sunday, March 13, 2016

More Generative Art with the LogoTurtle

My first idea for making generative art with Drawson, my LogoTurtle, was along these lines. Here are a couple more ideas I am playing with. These are a little harder to code than the earlier "exploded shapes." My fascination with these is split between finding the beauty in the shapes that come out of them and in the process by which the overall composition is built up over time out of small random decisions.

Random Circles

Have the turtle draw random circles all over and see what happens. Here is the algorithm:
  • forever...
  • turn to face a random direction
  • move forward a random distance up to 250 steps
  • draw a circle of a random size 
  • if it goes off the paper restart it in a sparse area and stop when you feel like it's done
You will notice in my code it makes a circle by going 390 degrees. That is because my turtle is having some trouble with arcs so I've been having to make adjustments in the code. Here is the code I used:
to bubbles
loop [
rt random 0 360
fd random 0 250
pd
arcrt 390 random 10 100
pu
]
end
And it made this picture on 11" X 18" paper. Of course if I did it again it would make a different picture, which is a lot of the fun:













Random Blocks

Have the turtle draw a random assortment of open and closed shapes with right angles. 
  • forever...
  • draw 30 step segments
  • each segment there is a 30% chance the pen will be up and 70% chance it will be down
  • before each segment there is a 33% chance it will turn right, left, or go straight
  • and a little human intervention, if it goes off the paper I restart it somewhere the drawing is sparse
Here is the code. The parentheses around the random command are to contain the first half of the ifelse test. To break up the probability of the turns into thirds, the test for results from 0-2 and 3-5 is nested inside the first result of the test between 0-5 and 6-8:

to blocks
loop [
ifelse (random 0 10) < 3 
[pu]
[pd]
let [pick (random 0 8)]
ifelse :pick < 6
[ifelse :pick < 3
[rt 90]
[lt 90]
]
[rt 0]
fd 30
]
end
And the result (this time):


No comments :