Civilization model
Model was written in NetLogo 5.2.0
•
Viewed 826 times
•
Downloaded 65 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Click to Run Model
__includes ["setup.nls" "islandcreate.nls" "movement.nls" "creation.nls" "boatstuff.nls" "strategy.nls"] extensions [cf] globals[randomxpos randomypos goldminecount forestcount berrycount homexpos homeypos homexpos2 homeypos2 goldpatch foundgold woodpatch foundwood berrypatch foundberry homepatch food wood gold fooddecrease foodcounter goldpatch2 foundgold2 woodpatch2 foundwood2 berrypatch2 foundberry2 homepatch2 food2 wood2 gold2 testingstuff locationxpos locationypos foundspot havetemple locationpatch buildpatch needtobuild buildcolor totalresources currentplayer foodweight woodweight goldweight foodweight2 woodweight2 goldweight2 strategyset strategyset2 totalresources2 farmnumber lumbermillnumber forgenumber farmnumber2 lumbermillnumber2 forgenumber2 enabletrade lowresource lowresource2 highresource highresource2 goldmax goldmax2 foodmax foodmax2 woodmax woodmax2 madmax enabletrade2 boatnumber2 finishpatch finishpatch2 done done2 hasdock hasdock2 constructioncolor havebarracks barrackspatch templepatch swordsmannumber armylocationx armylocationy armymove armynumber havedock dockpatch boatnumber boatmove armydest boatdest gowest goeast boatlocationx boatlocationy newdest walllocationx walllocationy] turtles-own[goinghomegold goinghomeberry goinghomewood goinghomebuild resources alsoplayer maxresourcelevel cargo cargofull startedboat] patches-own[resourcetotal resourcelevel iswall player isborder] breed [miners miner] breed [woodcutters woodcutter] breed [farmers farmer] breed [builders builder] breed [swordsmen swordsman] breed [transportships transportship] to go ;; this checks with all of the workers and figures out what they should do. It then runs the appropriate strategies, ;; and checks to see if either civilization has collected all available resources ask miners with [alsoplayer = 1] [ ifelse foundgold = 1 or goinghomegold = 1 [gomine] [moveminers] ] ask woodcutters with [alsoplayer = 1] [ ifelse foundwood = 1 or goinghomewood = 1 [gochop] [movewoodcutters] ] ask farmers with [alsoplayer = 1] [ ifelse foundberry = 1 or goinghomeberry = 1 [gofarm] [movefarmers] ] ask miners with [alsoplayer = 2] [ ifelse foundgold2 = 1 or goinghomegold = 1 [gomine] [moveminers] ] ask woodcutters with [alsoplayer = 2] [ ifelse foundwood2 = 1 or goinghomewood = 1 [gochop] [movewoodcutters] ] ask farmers with [alsoplayer = 2] [ ifelse foundberry2 = 1 or goinghomeberry = 1 [gofarm] [movefarmers] ] ifelse strategyset = 1 [ runstrategy 1 strategy ] [ setrunstrategy 1 strategy ] ifelse strategyset2 = 1 [ runstrategy 2 strategy2 ] [ setrunstrategy 2 strategy2 ] checkend tick end to changemax [pickplayer typeworker] ;; this changes the maximum amount of resources a worker can collect at one time, which is a result ;; of creating a building that corresponds to that type of worker (cf:cond cf:case [typeworker = "farmers"] [ ask farmers with [alsoplayer = pickplayer] [ if pickplayer = 1 [ set maxresourcelevel foodmax ] if pickplayer = 2 [ set maxresourcelevel foodmax2 ] ] ] cf:case [typeworker = "woodcutters"] [ ask woodcutters with [alsoplayer = pickplayer] [ if pickplayer = 1 [ set maxresourcelevel woodmax ] if pickplayer = 2 [ set maxresourcelevel woodmax2 ] ] ] cf:case [typeworker = "miners"] [ ask miners with [alsoplayer = pickplayer] [ if pickplayer = 1 [ set maxresourcelevel goldmax ] if pickplayer = 2 [ set maxresourcelevel goldmax2 ] ] ]) end to comprun [buildtype curplayer] ;; this checks what is supposed to be built, and if it't not a dock, it changes the maximum ;; amount of resources that the corresponding workers can collect at one time (cf:cond cf:case [buildtype = "farm"][genericbuild 125 curplayer 300 wood if curplayer = 1 [ set foodmax (foodmax + 10) ] if curplayer = 2 [ set foodmax2 (foodmax2 + 10) ] changemax curplayer "farmers"] cf:case [buildtype = "lumbermill"][genericbuild 85 curplayer 300 wood if curplayer = 1 [ set woodmax (woodmax + 10) ] if curplayer = 2 [ set woodmax2 (woodmax2 + 10) ] changemax curplayer "woodcutters"] cf:case [buildtype = "forge"][genericbuild 25 curplayer 300 wood if curplayer = 1 [ set goldmax (goldmax + 10) ] if curplayer = 2 [ set goldmax2 (goldmax2 + 10) ] changemax curplayer "miners"] cf:case [buildtype = "dock"][genericbuilddock 36 curplayer 800 gold ]) end to increasefood [whichplayer amt] ;; this increases the total food, and increases total resources if it is a positive gain if whichplayer = 1 [ set food (food + amt) if amt > 0 [ set totalresources (totalresources + amt) ] ] if whichplayer = 2 [ set food2 (food2 + amt) if amt > 0 [ set totalresources2 (totalresources2 + amt) ] ] end to increasewood [whichplayer amt] ;; this increases the total wood, and increases total resources if it is a positive gain if whichplayer = 1 [ set wood (wood + amt) if amt > 0 [ set totalresources (totalresources + amt) ] ] if whichplayer = 2 [ set wood2 (wood2 + amt) if amt > 0 [ set totalresources2 (totalresources2 + amt) ] ] end to increasegold [whichplayer amt] ;; this increases the total gold, and increases total resources if it is a positive gain if whichplayer = 1 [ set gold (gold + amt) if amt > 0 [ set totalresources (totalresources + amt) ] ] if whichplayer = 2 [ set gold2 (gold2 + amt) if amt > 0 [ set totalresources2 (totalresources2 + amt) ] ] end to checkend ;; this checks to see if a civilization has collected all available resources if (count patches with [pcolor = 44 and player = 1] + count patches with [pcolor = 52 and player = 1] + count patches with [pcolor = 13 and player = 1] = 0) [ ask finishpatch [ set pcolor green ask neighbors [ set pcolor green ] set done 1 ] ] if (count patches with [pcolor = 44 and player = 2] + count patches with [pcolor = 52 and player = 2] + count patches with [pcolor = 13 and player = 2] = 0) [ ask finishpatch2 [ set pcolor green ask neighbors [ set pcolor green ] set done2 1 ] ] end
There are 5 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Civilization model.png | preview | Preview for 'Civilization model' | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
Gabe Pezanoski-Cohen's Final Project.zip | extension | Zipped final project in case there's trouble downloading it | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
GabePezanoski-Cohen_June1V3.docx | word | Progress Report for June 1st | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
GabePezanoski-Cohen_May25V2.docx | word | Progress Report for May 25th | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
GabePezanoskiCohen_May18_V1.docx | word | Progress Report for May 18th | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
GabrielPezanoski-CohenFinalReport.pdf | Final Report | over 9 years ago, by Gabriel Pezanoski-Cohen | Download | |
myposter.pdf | My poster | over 9 years ago, by Gabriel Pezanoski-Cohen | Download | |
Pezanoski-Cohen_Gabe_Slam.pptx | powerpoint | Poster Slam slides | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
ProjectProposal.pdf | Project Proposal | over 9 years ago, by Gabriel Pezanoski-Cohen | Download |
This model does not have any ancestors.
This model does not have any descendants.
Gabriel Pezanoski-Cohen
Info
First step of my civilization model. Swordsman doesn't work yet
Posted over 9 years ago