Garden ecosystem
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This view of a garden bed shows what happens when a farmer tries to plant and grow a variety of crops.
HOW IT WORKS
You act as the farmer, and can select how many seeds to plant, how far apart they should be spaced, and what additives you'd like to put into the soil. You can also harvest your plants, sell them, and seed again.
HOW TO USE IT
Set the slider buttons on the top of the screen to the value that you'd like, then press 'Setup'. When you're ready to start, press 'go', and then the farmer will follow your mouse. Hold down the mouse button to harvest a plant. You can click the interface buttons at any time while the model is running, or press 'go' again to pause it.
THINGS TO NOTICE
Check out the Populations graph on the lower left. What do you think each line color represents?
What happens to the color of the soil as you let the model run?
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [farmers farmer] breed [plants plant] breed [weeds weed] turtles-own [energy my-heading] patches-own [nutrients fertile] ;; nutrients determines the soil quality. fertile determines if a seed can be sprouted there; affected by spacing. globals [ total-harvested;; lbs of produce harvested by the farmer money;; budget for the project crop ] to setup clear-all setup-patches setup-turtles make-farmer reset-ticks set money (budget - (count plants * plant-cost)) end to setup-patches ask patches [ set nutrients (random 15) ] repeat 5 [diffuse nutrients 1] ask patches [ set pcolor scale-color brown nutrients 10 0 if remainder pxcor spacing = 0 and remainder pycor spacing = 0 [set fertile true ]] end to setup-turtles create-weeds 0 end to make-farmer create-farmers 1 [ set color cyan set size 3 set shape "farmer" setxy 0 0 set heading 90 set my-heading 270 run "seed" ] end to seed repeat (number-plants) [ ask farmers [ (ask patch-here [ if fertile = true and not any? plants-here [ sprout-plants 1 [ set shape "plant" set size 0.2 set energy 2 ]]]) fd (spacing) if not can-move? 1 [ set heading 0 fd spacing set heading my-heading ifelse my-heading = 90 [set my-heading 270] [set my-heading 90] ]] ] end to re-seed repeat (number-plants * spacing) [ ask farmers [fd spacing (ask patch-here [ if fertile = true and not any? plants-here [ sprout-plants 1 [ set shape "plant" set size 0.2 set energy 2 ]]]) if not can-move? 1 [ set heading 0 fd spacing set heading my-heading ifelse my-heading = 90 [set my-heading 270] [set my-heading 90] ]]] end to go animate tick end to animate ask turtles [ run word breed "-grow" run word breed "-check-if-dead" run word breed "-eat" ] ;wait 1 if any? patches with [not any? plants-here and nutrients > 5] [ ask one-of patches with [not any? plants-here and nutrients > 5] [ sprout-weeds 1 [ set breed weeds set shape "flower budding" set color lime set energy 1 set size 0.03;; somehow I want to adjust this so that plants are more likely to appear in spaces with high nutrient level harvest-plants harvest-weeds ]]] end to plants-grow if (energy > 3) [set size size + 0.02] end to weeds-grow;; if (energy > 2) [set size size + 0.04];; arbitrary numbers but weeds grow faster end to farmers-grow end to plants-check-if-dead if (energy <= 0) [ set nutrients (nutrients + 0.5) set pcolor scale-color brown nutrients 10 0 die ] ;;maybe have them "flash" before they die, or 'turn red, wait 3' so we know to look at them **note that i can't get this part to work. they freeze up. end to weeds-check-if-dead if (energy <= 0) [ die ] end to farmers-check-if-dead end to plants-eat if (nutrients >= 1) [ set energy energy + 1 set nutrients (nutrients - 0.2) ask neighbors4 [set nutrients (nutrients - 0.05) set pcolor scale-color brown nutrients 10 0];; plants slowly take nutrients from soil set pcolor scale-color brown nutrients 10 0] if (nutrients < 1) [ set energy energy - 0.1];; if no nutrients in the soil, this arbitrary rate is how fast they will die end to weeds-eat if (nutrients >= 1) [ set energy energy + 1 set nutrients (nutrients - 0.1) ask neighbors4 [ set nutrients (nutrients - 0.08) set pcolor scale-color brown nutrients 10 0];; weeds take nutrients from soil less quickly set pcolor scale-color brown nutrients 10 0] if (nutrients < 1) [ set energy energy - 0.1];; if no nutrients in the soil, this arbitrary rate is how fast they will die end to farmers-eat end to harvest-plants ask farmers [ set hidden? not mouse-inside? setxy mouse-xcor mouse-ycor ] if mouse-inside? and mouse-down? [ set crop plants with [distance one-of farmers < (size / 2)] if any? crop [ let weight sum [size] of crop set total-harvested (total-harvested + (ceiling (1.5 * weight * count crop))) ask crop [ die ] ]] end to harvest-weeds ask farmers [ set hidden? not mouse-inside? setxy mouse-xcor mouse-ycor ] if mouse-inside? and mouse-down? [ let weedable weeds with [distance one-of farmers < (size * 2)] if any? weedable [ ask weedable [ die ] ] ] end to add-compost ask patches [set nutrients (nutrients + 5) set pcolor scale-color brown nutrients 10 0 ] set money (money - 20) end to add-herbicide ask weeds [die] ask plants [ set energy energy - 2] ask patches [set nutrients (nutrients - 2) set pcolor scale-color brown nutrients 10 0 ] set money (money - 30) end
There is only one version of this model, created almost 8 years ago by Becca Shareff.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.