Homework 3
I’d like to simulate animals breaking out of Central Park Zoo and running around the city. This would be a good way to work with agent based models and see how the animals interacted with the urban/park environment, with each other and with other humans in the area.
Premise: Animals from Central Park Zoo escape and are running all over the park
Map Base:
-code the environment
-Buildings
-Trees
-water
-paths
Agents: Animals
Penguins
Leopard
Bear
Sloth
Otter
Bird
Pigeons
Humans
Parameters for the Agents:
Movement
Speed of movement
Where to move?
Rules:
- Predator meets prey. Prey flees. Predator attacks. Predator either gets prey or doesn’t. Symbolized by dead prey symbol.
- Movement: Different movement actions: chase prey, find water, find vegetation, run away to city
- Speed of movement: changes all the time depending on the rules
my population below is represented by squares, with all of them moving randomly at different speeds
x = 100
y = 100
xspeed = 10
yspeed = 20
popSize = 150
noiseValue = 0
noiseScale = 0.20def setup():
size(800,800)
i = 10
for i in range(popSize):
x = random(10,width)
y = random(10,height)
stroke(0)
rect(x,y,10,10)def draw():
global x, y, xspeed, yspeed
fill(0)
fill(0)
background(0)
for y in range(height):
for x in range(width):
noiseValue = noise(x * noiseScale, y * noiseScale)
stroke(noiseValue * 20)
point(x, y)i = 0
for i in range(popSize/2):
x = random(0,width)
y = random(0,height)
noStroke()
fill(random(0,100), random(0,100),random(0,100))
rect(x,y,15,15)
frameRate(10)
for i in range(popSize/2):
x = random(0,width)
y = random(0,height)
noStroke()
fill(random(0,255), random(0,255),random(0,255))
rect(x,y,15,15)