This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extensions [ csv fetch ] | |
| turtles-own [ number code flag ] | |
| to setup | |
| fetch:url-async "https://gist.githubusercontent.com/LaCuneta/dbc4acb709fc4294f62fe5c4665e2b6d/raw/582ffd51f6065b8229dc4a40acd981c6653aaeeb/file.txt" [ data -> | |
| let rows (csv:from-string data " ") | |
| show rows ; prints: [[10 "gggg" false] [18 "gfgg" true] [12 "fsfg" false] [14 "ffff" false] [8 "eeee" false]] | |
| setup-turtles rows | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 10 "gggg" false | |
| 18 "gfgg" true | |
| 12 "fsfg" false | |
| 14 "ffff" false | |
| 8 "eeee" false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| breed [houses house] | |
| breed [people person] | |
| to setup | |
| clear-all | |
| create-houses 10 [ | |
| setxy random-xcor random-ycor | |
| ; this model uses a special version of the `house` shape that extends all the way to the bottom, top, and sides | |
| ; of the shape space, and also has a blank door so agents can be seen "behind" the house. Without the size change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| breed [decors decor] | |
| to make-grid | |
| clear-all | |
| ask patches [ sprout 1 [ | |
| if outline-color != black [ | |
| set color outline-color | |
| ] | |
| ifelse top-edges? and right-edges? and bottom-edges? and left-edges? [ | |
| stamp-square-outline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| patches-own [ heat ] | |
| to setup | |
| clear-all | |
| set-default-shape turtles "circle" | |
| create-turtles num-turtles ; each turtle is like a heat source | |
| [ setxy random-xcor random-ycor ; position the turtles randomly | |
| hide-turtle ; so we don't see the turtles themselves, just the heat they produce | |
| set heat turtle-heat ] ; turtles set the patch variable | |
| recolor-patches ; color patches according to heat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| turtles-own [ | |
| pause | |
| ] | |
| to setup | |
| clear-all | |
| resize-world -100 100 -100 100 ; 1 unit = 1 mm | |
| ; make sure the turtles can't wrap at the patches at the edges that touch | |
| __change-topology false false | |
| set-patch-size 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| turtles-own [ | |
| pause | |
| ] | |
| to setup | |
| clear-all | |
| resize-world -100 100 -100 100 ; 1 unit = 1 mm | |
| ; make sure the turtles can't wrap at the patches at the edges that touch | |
| __change-topology false false | |
| set-patch-size 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extensions [import-a fetch] | |
| to Set-up | |
| ca | |
| reset-ticks | |
| load_env | |
| end | |
| to load_env | |
| let x fetch:url "https://gist.githubusercontent.com/LaCuneta/d45c97626e040058df846b7fbd39a7f3/raw/ebe34602af995679b07ff5d15c3bef6209c50044/abm.csv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extensions [ send-to ] | |
| to setup | |
| clear-all | |
| ask patches [ set pcolor 64 ] | |
| ask patches [ | |
| let new-color wobble [pcolor] of one-of neighbors | |
| set pcolor new-color | |
| ] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; two breeds of turtle: bugs and predators | |
| breed [bugs bug] | |
| bugs-own [ | |
| red-gene ;; gene for strength of expressing red pigment (0-100) | |
| blue-gene ;; gene for strength of expressing blue pigment (0-100) | |
| green-gene ;; gene for strength of expressing green pigment (0-100) | |
| birthday ;; when this bug was born | |
| ] |
NewerOlder