kaka
kaka

Reputation: 825

how do I place my turtles within a square of 5 x 5 patches and 10 x 10 patches?

I am trying to randomly place my turtles within a square of 5 by 5 patches, I have 2 questions as below:

Upvotes: 1

Views: 105

Answers (1)

King-Ink
King-Ink

Reputation: 2096

Your code would place the turtles running it in a 5 X 5 square centered on patches with the bottom-left corner on patch 50 60.

If you want it to be 10 x 10

 setxy (50 + random 10) (60 + random 10)

if you want them not to be have to centered on patches use random-float thus. The patch center coordinates are integers.

setxy (50 + random-float 5) (60 + random-float 5)

If your world is not big enough they will wrap around.

Upvotes: 1

Related Questions