New Mexico AIS Challenge
SER/SFPS Career Academy
This Project utilized the agent-based computer program StarLogo. To access the program you must first download StarLogo on your machine. Click here to download http://education.mit.edu/starlogo/. To view the finished model click here StarLogo Model.

The Code Java StarLogo 2.0 english `turtle` breeds [female male] turtles-own [A1 A2 age coupleID] to go wiggle die-of-old-age end to wiggle fd 1 rt random 25 lt random 25 set age (age + 0.01) match2 end to match2 if breed = female [grab one-of-male-here [set coupleID partner set coupleID-of partner (who) if (age > 18 and age < 100) and ((age-of partner) > 18 and (age-of partner) < 100) [reproduce who partner] ] ] end to reproduce :mom :dad ; parameters passed in the reproduce call if (age > 19 and age < 40) [ifelse (random 2) = 0 [let [:gA1 A1-of :mom]] [let [:gA1 A2-of :mom]] ifelse (random 2) = 0 [let [:gA2 A1-of :dad]] [let [:gA2 A2-of :dad]] hatch [set age 0 set A1 :gA1 set A2 :gA2 ifelse (random 2) = 0 [set breed male setshape 12 setc 107] [set breed female setshape 13 setc 17] if (random 400) = 0 [mutation] ] ] end to mutation if (age > 30 and age < 39) and (random 1000) <= 15 [die] if (age > 40 and age < 49) and (random 1000) <= 48 [die] if (age > 50 and age < 59) and (random 1000) <= 92 [die] if (age > 60 and age < 69) and (random 1000) <= 128 [die] if (age > 70 and age < 79) and (random 1000) <= 150 [die] if (age > 80 and age < 100) and (random 1000) <= 154 [die] end to die-of-old-age if age > 100 [die] end `observer` to setup ca create-female-and-do number [setc red setshape 13 set age random 80] create-male-and-do number2 [setc blue setshape 12 set age random 80] ask-turtles [setx random 50 sety random 50] ask-turtles [ifelse (random 400) < 1 [set A1 0 set A2 0] [set A2 1 set A1 0] ifelse (random 2) = 1 [set A2 1 set A1 0] [set A1 1 set A2 1] ] end