Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+10 votes

Im trying to create multiple squares of random size as shown below:

repeat 4 [ forward 2 + random 3 right 90]

but this only creates four lines of random size which does not make a square. Does anyone have any suggestions? Thanks.

asked in CSC 150 January201920 by (1 point)

1 Answer

+7 votes

You can try creating multiple turtles for each square. Or if you want to do it with only one turtle, You can try:

pd
repeat 4 [fd 2 right 90]
pen-up
fd 3
pd
let x random 6
repeat 4 [fd x right 90]

answered by (1 point)
+3

It ended up being easier to just do separate turtles, thanks for the help

...