Cops and Robbers Project

A cops and robbers simulation that models money transfer between banks, robbers, citizens, and police that all play an individual role.



Agents

Number of agents: 6

Behaviors


BankBank

Number of methods: 2


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 6 

If
SEE ((0 0) , bank), and
SEE ((0 1) , citizen)
Then
SET (money , to , money+(@transfer)), and
SET (@transfer , to , 0)

If
SEE ((0 0) , bank), and
SEE ((0 -1) , citizen)
Then
SET (money , to , money+(@transfer)), and
SET (@transfer , to , 0)

If
SEE ((0 0) , bank), and
SEE ((-1 0) , citizen)
Then
SET (money , to , money+(@transfer)), and
SET (@transfer , to , 0)

If
SEE ((0 0) , bank), and
SEE ((1 0) , citizen)
Then
SET (money , to , money+(@transfer)), and
SET (@transfer , to , 0)

If
SEE ((0 0) , bank), and
SEE ((0 1) , citizen), and
%-CHANCE (50)
Then
SET (money , to , 0), and
SET (@transfer , to , money)

If
SEE ((0 0) , bank), and
SEE ((0 1) , cop)
Then
SET (money , to , money+(@transfer))

WHEN-CREATING-NEW-AGENT ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , bank)
Then
SET (money , to , 0)



CitizenCitizen

Number of methods: 2


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 13 

If
SEE ((0 0) , citizen), and
IS (money , > , 5000)
Then
CHANGE ((0 0) , wealthycitizen), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , wealthycitizen), and
%-CHANCE (5)
Then
SET (money , to , 1000), and
CHANGE ((0 0) , citizen)

If
SEE ((0 0) , citizen), and
SEE ((0 1) , bank)
Then
SET (@transfer , to , @transfer+(money*.50)), and
SET (money , to , money-(money*.50)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((0 -1) , bank)
Then
SET (@transfer , to , @transfer+(money*.50)), and
SET (money , to , money-(money*.50)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((-1 0) , bank)
Then
SET (@transfer , to , @transfer+(money*.50)), and
SET (money , to , money-(money*.50)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((1 0) , bank)
Then
SET (@transfer , to , @transfer+(money*.50)), and
SET (money , to , money-(money*.50)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((0 1) , bank)
Then
SET (money , to , @transfer), and
SET (@tranfer , to , 0)

If
SEE ((0 0) , citizen), and
SEE ((0 1) , robber)
Then
SET (money , to , money-(money*.25)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((0 -1) , robber)
Then
SET (money , to , money-(money*.25)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((1 0) , robber)
Then
SET (money , to , money-(money*.25)), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen), and
SEE ((-1 0) , robber)
Then
SET (money , to , money-(money*.25)), and
MOVE-RANDOM-ON (city)

If
ONCE-EVERY (30 , Secs), and
SEE ((0 0) , citizen)
Then
SET (money , to , money+1000), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , citizen)
Then
MOVE-RANDOM-ON (city)

WHEN-CREATING-NEW-AGENT ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , citizen)
Then
SET (money , to , 1000)



CityCity

Number of methods: 1


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , city)
Then
SET (robbyness , to , (robbyness[up] + robbyness[down] + robbyess[left] + robbyness[right])/4), and
MAP (robbyness , to Color , between , 8947848 , for , 0 , and , 15204352 , for , 1000)



CopCop

Number of methods: 3


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 8 

If
SEE ((0 0) , cop), and
IS (money , > , 1000), and
SEE ((0 1) , bank)
Then
MOVE ((0 1))

If
SEE ((0 0) , cop), and
SEE ((0 1) , bank)
Then
SET (@transfer , to , money), and
SET (money , to , 0)

If
SEE ((0 0) , cop), and
NEXT-TO (>= , 1 , robber)
Then
SET (money , to , money+@transfer), and
SET (@transfer , to , 0), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , cop), and
IS (robbyness , >= , 1)
Then
MAKE ((0 0) , chase_robber)

If
SEE ((0 0) , cop), and
IS (robbyness , >= , 1)
Then
MAKE ((0 0) , chase_robber)

If
SEE ((0 0) , cop), and
IS (robbyness , >= , 1)
Then
MAKE ((0 0) , chase_robber)

If
SEE ((0 0) , cop), and
IS (robbyness , >= , 1)
Then
MAKE ((0 0) , chase_robber)

If
SEE ((0 0) , cop)
Then
MOVE-RANDOM-ON (city)

ON (chase_robber)

Put text here to explain what this method does!

Number of rules: 4 

If
SEE ((0 0) , cop), and
SEE ((-1 0) , city), and
IS (robbyness[up] , > , robbyness[down]), and
IS (robbyness[up] , > , robbyness[left]), and
IS (robbyness[up] , > , robbyness[right])
Then
MOVE ((-1 0))

If
SEE ((0 0) , cop), and
SEE ((1 0) , city), and
IS (robbyness[down] , > , robbyness[up]), and
IS (robbyness[down] , > , robbyness[left]), and
IS (robbyness[down] , > , robbyness[right])
Then
MOVE ((1 0))

If
SEE ((0 0) , cop), and
SEE ((0 1) , city), and
IS (robbyness[right] , > , robbyness[up]), and
IS (robbyness[right] , > , robbyness[left]), and
IS (robbyness[right] , > , robbyness[down])
Then
MOVE ((0 1))

If
SEE ((0 0) , cop), and
SEE ((0 -1) , city), and
IS (robbyness[left] , > , robbyness[up]), and
IS (robbyness[left] , > , robbyness[down]), and
IS (robbyness[left] , > , robbyness[right])
Then
MOVE ((0 -1))

WHEN-CREATING-NEW-AGENT ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , cop)
Then
SET (money , to , 1)



RobberRobber

Number of methods: 3


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 6 

If
SEE ((0 0) , robber), and
SEE ((0 0) , citizen)
Then
SET (money , to , money+1000)

If
SEE ((0 0) , robber), and
SEE ((-1 0) , cop)
Then
SET (robbyness , to , 0), and
SET (@transfer , to , money-(money*.25)), and
SET (money , to , money-(money*.25)), and
BROADCAST (Robber , stolen), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , robber), and
SEE ((1 0) , cop)
Then
SET (robbyness , to , 0), and
SET (@transfer , to , money-(money*.25)), and
SET (money , to , money-(money*.25)), and
BROADCAST (Robber , stolen), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , robber), and
SEE ((0 -1) , cop)
Then
SET (robbyness , to , 0), and
SET (@transfer , to , money-(money*.25)), and
SET (money , to , money-(money*.25)), and
BROADCAST (Robber , stolen), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , robber), and
SEE ((0 1) , cop)
Then
SET (robbyness , to , 0), and
SET (@transfer , to , money-(money*.25)), and
SET (money , to , money-(money*.25)), and
BROADCAST (Robber , stolen), and
MOVE-RANDOM-ON (city)

If
SEE ((0 0) , robber)
Then
MAP (robbyness , to Color , between , 0 , for , 0 , and , 16777215 , for , 500), and
MOVE-RANDOM-ON (city), and
SET (robbyness , to , robbyness+1)

WHEN-CREATING-NEW-AGENT ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , robber)
Then
SET (money , to , 1), and
SET (robbyness , to , 1)

ON (stolen)

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , robber), and
NEXT-TO (>= , 1 , citizen)
Then
SET (money , to , money+@transfer), and
SET (@transfer , to , 0)



SpawnerSpawner

Number of methods: 1


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 1 

If
KEY (49)
Then
NEW ((-1 0) , citizen), and
NEW ((0 -1) , citizen), and
NEW ((0 1) , citizen), and
NEW ((1 0) , citizen), and
NEW ((1 0) , cop), and
NEW ((-1 0) , cop), and
NEW ((0 -1) , cop), and
NEW ((0 1) , cop), and
NEW ((0 1) , robber), and
NEW ((0 -1) , robber), and
NEW ((-1 0) , robber), and
NEW ((1 0) , robber)


This report was generated using AgentSheets Version 3.0.0