The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.
powered by NetLogo
view/download model file: two_population_model.nlogo
breed [ Blacks BlackAgent ] breed [ Whites WhiteAgent ] breed [ Grays GrayAgent ] turtles-own [ age ] to setup clear-all reset-ticks ask patches [ set pcolor 95 ] ask turtles [ set age 0 ] create-Blacks BlacksInitialNumber ; initial number of agents of Black class [ set color Black set shape "person" setxy random-xcor random-ycor ] create-Whites WhitesInitialNumber ; initial number of agents of White class [ set color White set shape "person" setxy random-xcor random-ycor ] end to move if count turtles = 0 [ stop ] if count turtles >= 2000 [ stop ] go perish beborn ask Blacks [ copulate ] ask turtles [ set age age + 1 ] tick if ticks >= 1000 [ stop ] end to go ask turtles [ forward random 2 right random 360 ] end to perish ask Blacks [ if (random-float 1) <= (1 -(exp(-((age)/(BlacksAveDeathAge))))) [ die ] ; death of the agents of the Black class ] ask Whites [ if (random-float 1) <= (1 -(exp(-((age)/(WhitesAveDeathAge))))) [ die ] ; death of the agents of the White class ] ask Grays [ if (random-float 1) <= ((0.5)*(2 -((exp(-((age)/(BlacksAveDeathAge))))+((exp(-(age)/(WhitesAveDeathAge))))))) [ die ] ; death of the agents of the Gray class ] end to beborn ask Blacks [ if age = random-poisson BlacksAveReproductionAge [ hatch random-poisson BlacksAveChildrenNumber [ set age 0 ] ; birth of the agents of the Black class ]] ask Whites [ if age = random-poisson WhitesAveReproductionAge [ hatch random-poisson WhitesAveChildrenNumber [ set age 0 ] ; birth of the agents of the White class ]] end to copulate let partner one-of Whites-here ; generation of Gray Agents if partner != nobody [ hatch-Grays ((0.5)*((random-poisson WhitesAveChildrenNumber)+(random-poisson BlacksAveChildrenNumber))) [ set age 0 set color 3 set shape "person" setxy random-xcor random-ycor ] ] end