[{"data":1,"prerenderedAt":3455},["ShallowReactive",2],{"/tutorial3":3,"/tutorial3-surround":3444},{"id":4,"title":5,"body":6,"description":3411,"extension":3412,"meta":3413,"navigation":3431,"path":3440,"seo":3441,"stem":3442,"__hash__":3443},"content/tutorial3.md","Tutorial #3: Procedures",{"type":7,"value":8,"toc":3388},"minimark",[9,21,25,134,142,145,148,151,154,161,164,189,203,206,209,286,298,301,326,329,418,429,432,435,442,448,458,461,468,471,491,502,505,508,544,554,565,659,684,690,740,749,752,760,767,770,799,833,842,872,875,878,885,888,1075,1086,1092,1099,1102,1105,1108,1131,1174,1180,1310,1335,1338,1411,1414,1432,1439,1442,1472,1482,1500,1503,1552,1563,1601,1604,1611,1618,1621,1624,1650,1661,1778,1794,1797,1807,1816,1823,1826,2078,2099,2133,2139,2146,2149,2160,2163,2170,2173,2187,2253,2265,2272,2275,2286,2293,2296,2308,2311,2314,2321,2327,2336,2339,2421,2424,2452,2459,2462,2521,2524,2527,2738,2741,2748,2751,2754,2757,2774,2777,2791,2794,2797,2804,2807,2810,2813],[10,11,15],"h1",{"id":12,"className":13},"tutorial-3-procedures",[14],"section-heading",[16,17,5],"a",{"className":18,"href":20},[19],"section-anchor","#tutorial-3-procedures",[22,23,24],"p",{},"This tutorial leads you through the process of building a complete model, built\nup in stages, with every step explained along the way.",[26,27,30,40],"div",{"className":28},[29],"toc",[31,32,35],"h4",{"id":33,"className":34},"table-of-contents",[14],[16,36,39],{"className":37,"href":38},[19],"#table-of-contents","Table of Contents",[41,42,43,50,56,62,68,74,80,86,92,98,104,110,116,122,128],"ul",{},[44,45,46],"li",{},[16,47,49],{"href":48},"#agents-and-procedures","Agents and procedures",[44,51,52],{},[16,53,55],{"href":54},"#making-the-setup-button","Making the setup button",[44,57,58],{},[16,59,61],{"href":60},"#switching-to-tick-based-view-updates","Switching to tick-based view updates",[44,63,64],{},[16,65,67],{"href":66},"#making-the-go-button","Making the go button",[44,69,70],{},[16,71,73],{"href":72},"#experimenting-with-commands","Experimenting with commands",[44,75,76],{},[16,77,79],{"href":78},"#patches-and-variables","Patches and variables",[44,81,82],{},[16,83,85],{"href":84},"#turtle-variables","Turtle variables",[44,87,88],{},[16,89,91],{"href":90},"#monitors","Monitors",[44,93,94],{},[16,95,97],{"href":96},"#switches-and-labels","Switches and labels",[44,99,100],{},[16,101,103],{"href":102},"#more-procedures","More procedures",[44,105,106],{},[16,107,109],{"href":108},"#plotting","Plotting",[44,111,112],{},[16,113,115],{"href":114},"#tick-counter","Tick counter",[44,117,118],{},[16,119,121],{"href":120},"#some-more-details","Some more details",[44,123,124],{},[16,125,127],{"href":126},"#whats-next","What’s next?",[44,129,130],{},[16,131,133],{"href":132},"#appendix-complete-code","Appendix: Complete code",[135,136,139],"h2",{"id":137,"className":138},"agents-and-procedures",[14],[16,140,49],{"className":141,"href":48},[19],[22,143,144],{},"In Tutorial #2, you learned how to use the command center and agent monitors to\ninspect and modify agents and make them do things. Now you’re ready to learn\nabout the real heart of a NetLogo model: the Code tab.",[22,146,147],{},"You’ve seen that agents in NetLogo are divided into patches, turtles, links, and\nthe observer. Patches are stationary and arranged in a grid. Turtles move over\nthat grid. Links connect two turtles. The observer oversees everything that’s\ngoing on and does whatever the turtles, patches and links can’t do for\nthemselves.",[22,149,150],{},"All four types of agents can run NetLogo commands. All four can also run\n“procedures”. A procedure combines a series of NetLogo commands into a single\nnew command that you define.",[22,152,153],{},"You will now learn to write procedures that make turtles move, eat, reproduce,\nand die. You will also learn how to make monitors, sliders, and plots. The model\nwe’ll build is a simple ecosystem model not unlike Wolf Sheep Predation from\nTutorial #1.",[135,155,158],{"id":156,"className":157},"making-the-setup-button",[14],[16,159,55],{"className":160,"href":54},[19],[22,162,163],{},"To start a new model, select “New” from the File menu. Then begin by creating a\nsetup button:",[165,166,167],"blockquote",{},[41,168,169,172,175,178,186],{},[44,170,171],{},"Click the “Add” icon in the toolbar at the top of the Interface tab.",[44,173,174],{},"On the menu next to Add, select Button (if it isn’t already selected).",[44,176,177],{},"Click wherever you want the button to appear in the empty white area of the\nInterface tab.",[44,179,180,181,185],{},"A dialog box for editing the button opens. Type ",[182,183,184],"code",{},"setup"," in the box labeled\n“Commands”.",[44,187,188],{},"Press the OK button when you’re done; the dialog box closes.",[22,190,191,192],{},"Now you have a setup button. Pressing the button runs a procedure called\n“setup”. A procedure is a sequence of NetLogo commands that we assign a new\nname. We’ll define that procedure soon, but we haven’t yet. The button refers to\na procedure that doesn’t exist, so the button turns red: ",[193,194],"img",{"alt":195,"className":196,"src":198,"width":199,"height":200,"style":201},"tutorial3/errors.png",[197],"netlogo-image","/_content/images/tutorial3/errors.png",541,286,{"aspectRatio":202},"541/286",[22,204,205],{},"If you want to see the actual error message, click the button.",[22,207,208],{},"Now we’ll create the “setup” procedure, so the error message will go away:",[165,210,211,219,237],{},[41,212,213,216],{},[44,214,215],{},"Switch to the Code tab.",[44,217,218],{},"Type the following:",[220,221,222],"pre",{},[182,223,224,225,232,233],{},"   ",[226,227,231],"span",{"className":228},[229,230],"token","keyword"," to"," ",[226,234,184],{"className":235},[229,236],"variable",[220,238,239],{},[182,240,241,242,247,241,250,232,254,259,260,232,264,232,269,273,274,241,276,280,224,282],{},"      ",[226,243,246],{"className":244},[229,245],"command","clear-all",[248,249],"br",{},[226,251,253],{"className":252},[229,245],"create-turtles",[226,255,258],{"className":256},[229,257],"number","100"," [ ",[226,261,263],{"className":262},[229,245],"setxy",[226,265,268],{"className":266},[229,267],"reporter","random-xcor",[226,270,272],{"className":271},[229,267],"random-ycor"," ]",[248,275],{},[226,277,279],{"className":278},[229,245],"reset-ticks",[248,281],{},[226,283,285],{"className":284},[229,230]," end",[22,287,288,289],{},"When you’re done, the Code tab looks like this: ",[193,290],{"alt":291,"className":292,"src":293,"width":294,"height":295,"style":296},"tutorial3/setupcode.png",[197],"/_content/images/tutorial3/setupcode.png",556,254,{"aspectRatio":297},"556/254",[22,299,300],{},"Note that some lines are indented. Most people find it helpful to indent their\ncode. It isn’t mandatory, but it makes the code easier to read and change.",[22,302,303,304,316,317,325],{},"Your procedure begins with ",[305,306,308],"primitive",{"displayText":307,"permalink":307},"to",[16,309,307],{"href":310,"className":311,"dataDisplayText":307,"rel":313,"target":315,"title":307},"/dictionary#to",[312],"netlogo-wiki-link",[314],"noopener","_self"," and ends with ",[305,318,320],{"displayText":319,"permalink":319},"end",[16,321,319],{"href":322,"className":323,"dataDisplayText":319,"rel":324,"target":315,"title":319},"/dictionary#end",[312],[314],". Every procedure begins\nand ends with these words.",[22,327,328],{},"Let’s look at what you typed in and see what each line of your procedure does:",[41,330,331,342,349,360,366,404,411],{},[44,332,333,341],{},[182,334,335,232,338],{},[226,336,307],{"className":337},[229,230],[226,339,184],{"className":340},[229,236]," begins defining a procedure named “setup”.",[44,343,344,348],{},[226,345,346],{},[226,347,246],{}," resets the world to an initial, empty state. All the patches\nturn black and any turtles you might have created disappear. Basically, it\nwipes the slate clean for a new model run.",[44,350,351,359],{},[182,352,353,232,356],{},[226,354,253],{"className":355},[229,245],[226,357,258],{"className":358},[229,257]," creates 100 turtles. They start out standing at the\norigin, that is, the center of patch 0,0.",[44,361,362,363,365],{},"After ",[182,364,253],{}," we can put commands for the new turtles to run,\nenclosed by square brackets.",[44,367,368,379,380,388,389,395,396,403],{},[182,369,370,232,373,232,376],{},[226,371,263],{"className":372},[229,245],[226,374,268],{"className":375},[229,267],[226,377,272],{"className":378},[229,267]," is a command using “reporters”. A reporter, as\nopposed to a command, reports a result. First each turtle runs the reporter\n",[305,381,383],{"displayText":268,"permalink":382},"random-cor",[16,384,268],{"href":385,"className":386,"dataDisplayText":268,"rel":387,"target":315,"title":268},"/dictionary#random-cor",[312],[314]," which will report a random number from the\nallowable range of turtle coordinates along the X axis. Then each turtle runs\nthe reporter ",[305,390,391],{"displayText":272,"permalink":382},[16,392,272],{"href":385,"className":393,"dataDisplayText":272,"rel":394,"target":315,"title":272},[312],[314],", same for the Y axis. Finally each\nturtle runs the ",[305,397,398],{"displayText":263,"permalink":263},[16,399,263],{"href":400,"className":401,"dataDisplayText":263,"rel":402,"target":315,"title":263},"/dictionary#setxy",[312],[314]," command with those two numbers as inputs. That makes\nthe turtle move to the point with those coordinates.",[44,405,406,410],{},[226,407,408],{},[226,409,279],{}," starts the tick counter, now that setup is otherwise complete.",[44,412,413,417],{},[226,414,415],{},[226,416,319],{}," completes the definition of the “setup” procedure.",[22,419,420,421],{},"When you’re done typing, switch to the Interface tab and press the setup button\nyou made before. You will see the turtles scattered around the world:\n",[193,422],{"alt":423,"className":424,"src":425,"width":426,"height":426,"style":427},"tutorial3/scatter.png",[197],"/_content/images/tutorial3/scatter.png",420,{"aspectRatio":428},"420/420",[22,430,431],{},"Press setup a couple more times, and see how the arrangement of turtles is\ndifferent each time. Note that some turtles may be right on top of each other.",[22,433,434],{},"Think a bit about what you needed to do to make this happen. You needed to make\na button in the interface and make a procedure that the button uses. The button\nonly worked once you completed both of these separate steps. In the remainder of\nthis tutorial, you will often have to complete two or more similar steps to add\nanother feature to the model. If something doesn’t appear to work after you\ncompleted what you thought is the final step for that new feature, continue to\nread ahead to see if there is still more to do. After reading ahead for a couple\nof paragraphs, you should then go back over the directions to see if there is\nany step you might have missed.",[135,436,439],{"id":437,"className":438},"switching-to-tick-based-view-updates",[14],[16,440,61],{"className":441,"href":60},[19],[22,443,444,445,447],{},"Now that we’re using the tick counter (with ",[182,446,279],{},"), we should tell\nNetLogo that it only needs to update the view once per tick, instead of\ncontinuously updating it.",[165,449,450],{},[41,451,452,455],{},[44,453,454],{},"Find the view updates menu. It’s above the view and by default says\n“continuous”.",[44,456,457],{},"Choose “on ticks” instead.",[22,459,460],{},"This makes your model run faster and ensures a consistent appearance (since the\nupdates will happen at consistent times). See the Programming Guide for a fuller\ndiscussion of view updates.",[135,462,465],{"id":463,"className":464},"making-the-go-button",[14],[16,466,67],{"className":467,"href":66},[19],[22,469,470],{},"Now make a button called “go”. Follow the same steps you used to make the setup\nbutton, except:",[165,472,473],{},[41,474,475,485,488],{},[44,476,477,478,481,482,484],{},"For Commands enter ",[182,479,480],{},"go"," instead of ",[182,483,184],{},".",[44,486,487],{},"Check the “Forever” checkbox in the edit dialog.",[44,489,490],{},"Check the “Disable until ticks start” checkbox too.",[22,492,493],{},[193,494],{"alt":495,"className":496,"src":497,"width":498,"height":499,"style":500},"tutorial3/gobutton.png",[197],"/_content/images/tutorial3/gobutton.png",567,532,{"aspectRatio":501},"567/532",[22,503,504],{},"The “Forever” checkbox makes the button stay down once pressed, so its commands\nrun over and over again, not just once.",[22,506,507],{},"The “Disable until ticks start” prevents you from pressing go before setup.",[165,509,510,515,525],{},[41,511,512],{},[44,513,514],{},"Then add a go procedure to the Code tab:",[220,516,517],{},[182,518,224,519,232,522],{},[226,520,231],{"className":521},[229,230],[226,523,480],{"className":524},[229,236],[220,526,527],{},[182,528,241,529,533,241,535,539,224,541],{},[226,530,532],{"className":531},[229,236],"move-turtles",[248,534],{},[226,536,538],{"className":537},[229,245],"tick",[248,540],{},[226,542,285],{"className":543},[229,230],[22,545,546,553],{},[305,547,548],{"displayText":538,"permalink":538},[16,549,538],{"href":550,"className":551,"dataDisplayText":538,"rel":552,"target":315,"title":538},"/dictionary#tick",[312],[314]," is a primitive that advances the tick counter by one tick.",[22,555,556,557,559,560,562,563,484],{},"But what is ",[182,558,532],{},"? Is it a primitive (in other words, built-in to\nNetLogo)? No, it’s another procedure that you’re about to add. So far, you have\nintroduced two procedures that you added yourself: ",[182,561,184],{}," and ",[182,564,480],{},[165,566,567,578,588],{},[41,568,569],{},[44,570,571,572,574,575,577],{},"Add the ",[182,573,532],{}," procedure after the ",[182,576,480],{},"procedure:",[220,579,580],{},[182,581,224,582,232,585],{},[226,583,231],{"className":584},[229,230],[226,586,480],{"className":587},[229,236],[220,589,590],{},[182,591,241,592,595,241,597,600,224,602,605,607,224,609,232,612,615,241,617,232,621,625,626,628,629,232,633,232,637,641,628,643,232,647,651,653,654,224,656],{},[226,593,532],{"className":594},[229,236],[248,596],{},[226,598,538],{"className":599},[229,245],[248,601],{},[226,603,285],{"className":604},[229,230],[248,606],{},[248,608],{},[226,610,231],{"className":611},[229,230],[226,613,532],{"className":614},[229,236],[248,616],{},[226,618,620],{"className":619},[229,245],"ask",[226,622,624],{"className":623},[229,267],"turtles"," [",[248,627],{},"        ",[226,630,632],{"className":631},[229,245],"right",[226,634,636],{"className":635},[229,267],"random",[226,638,640],{"className":639},[229,257],"360",[248,642],{},[226,644,646],{"className":645},[229,245],"forward",[226,648,650],{"className":649},[229,257],"1",[248,652],{},"      ]",[248,655],{},[226,657,285],{"className":658},[229,230],[22,660,661,662,664,665,680,681,683],{},"Note there are no spaces around the hyphen in ",[182,663,532],{},". In Tutorial #2 we\nused ",[182,666,667,232,672,232,676],{},[226,668,671],{"className":669},[229,670],"constant","red",[226,673,675],{"className":674},[229,267],"-",[226,677,679],{"className":678},[229,257],"2",", with spaces, in order to subtract two numbers, but here we want\n",[182,682,532],{},", without spaces. The ”-” combines “move” and “turtles” into a\nsingle name.",[22,685,686,687,689],{},"Here is what each command in the ",[182,688,532],{}," procedure does:",[41,691,692,707,729],{},[44,693,694,706],{},[182,695,696,232,699,259,702,273],{},[226,697,620],{"className":698},[229,245],[226,700,624],{"className":701},[229,267],[226,703,705],{"className":704},[229,236],"..."," says that each turtle should run the commands in the\nbrackets.",[44,708,709,720,721,728],{},[182,710,711,232,714,232,717],{},[226,712,632],{"className":713},[229,245],[226,715,636],{"className":716},[229,267],[226,718,640],{"className":719},[229,257]," is another command that uses a reporter. First, each turtle\npicks a random whole number between 0 and 359. (",[305,722,723],{"displayText":636,"permalink":636},[16,724,636],{"href":725,"className":726,"dataDisplayText":636,"rel":727,"target":315,"title":636},"/dictionary#random",[312],[314]," doesn’t include the\nnumber you give it as a possible result.) Then the turtle turns right this\nnumber of degrees.",[44,730,731,739],{},[182,732,733,232,736],{},[226,734,646],{"className":735},[229,245],[226,737,650],{"className":738},[229,257]," makes the turtle move forward one step.",[22,741,742,743,745,746,748],{},"Why couldn’t we have just written all of these commands in ",[182,744,480],{}," instead of in a\nseparate procedure? We could have, but during the course of building your\nproject, it’s likely that you’ll add many other parts. We’d like to keep ",[182,747,480],{}," as\nsimple as possible, so that it is easy to understand. Eventually, it will\ninclude many other things you want to have happen as the model runs, such as\ncalculating something or plotting the results. Each of these things to do will\nhave its own procedure and each procedure will have its own unique name.",[22,750,751],{},"The ‘go’ button you made in the Interface tab is a forever button, meaning that\nit will continually run its commands until you shut it off (by clicking on it\nagain). After you have pressed ‘setup’ once, to create the turtles, press the\n‘go’ button. Watch what happens. Turn it off, and you’ll see that all the\nturtles stop in their tracks.",[22,753,754,755,759],{},"Note that if a turtle moves off the edge of the world, it “wraps”, that is, it\nappears on the other side. (This is the default behavior. It can be changed; see\nthe ",[16,756,758],{"href":757},"/programming#topology","Topology"," section of the Programming Guide for\nmore information.)",[135,761,764],{"id":762,"className":763},"experimenting-with-commands",[14],[16,765,73],{"className":766,"href":72},[19],[22,768,769],{},"We suggest you start experimenting with other turtle commands.",[22,771,772,773,790,791,793,794,796,797,484],{},"Type commands into the Command Center (like ",[182,774,775,232,779,232,783,232,787],{},[226,776,778],{"className":777},[229,236],"turtles>",[226,780,782],{"className":781},[229,245],"set",[226,784,786],{"className":785},[229,267],"color",[226,788,671],{"className":789},[229,670],"), or add\ncommands to ",[182,792,184],{},", ",[182,795,480],{},", or ",[182,798,532],{},[22,800,801,802,793,804,793,807,796,810,813,814,822,823,832],{},"Note that when you enter commands in the Command Center, you must choose\n",[182,803,778],{},[182,805,806],{},"patches>",[182,808,809],{},"links>",[182,811,812],{},"observer>"," in the popup menu on the left,\ndepending on which agents are going to run the commands. It’s just like using\n",[182,815,816,232,819],{},[226,817,620],{"className":818},[229,245],[226,820,624],{"className":821},[229,267]," or ",[182,824,825,232,828],{},[226,826,620],{"className":827},[229,245],[226,829,831],{"className":830},[229,267],"patches",", but saves typing. You can also use the tab key\nto switch agent types, which you might find more convenient than using the menu.",[22,834,835,836,232,838,841],{},"You might try typing ",[182,837,778],{},[182,839,840],{},"pen-down"," into the Command Center and then\npressing the go button.",[22,843,844,845,847,848,859,860,484],{},"Also, inside the ",[182,846,532],{}," procedure you can try changing\n",[182,849,850,232,853,232,856],{},[226,851,632],{"className":852},[229,245],[226,854,636],{"className":855},[229,267],[226,857,640],{"className":858},[229,257]," to ",[182,861,862,232,865,232,868],{},[226,863,632],{"className":864},[229,245],[226,866,636],{"className":867},[229,267],[226,869,871],{"className":870},[229,257],"45",[22,873,874],{},"Play around. It’s easy and the results are immediate and visible — one of\nNetLogo’s many strengths.",[22,876,877],{},"When you feel you’ve done enough experimenting for now, you’re ready to continue\nimproving the model you are building.",[135,879,882],{"id":880,"className":881},"patches-and-variables",[14],[16,883,79],{"className":884,"href":78},[19],[22,886,887],{},"Now we’ve got 100 turtles aimlessly moving around, completely unaware of\nanything else around them. Let’s make things a little more interesting by giving\nthese turtles a nice background against which to move.",[165,889,890,898,908,937,948,958,984,1006,1011,1016,1026,1058,1067],{},[41,891,892],{},[44,893,894,895,897],{},"Go back to the ",[182,896,184],{}," procedure. We can rewrite it as follows:",[220,899,900],{},[182,901,224,902,232,905],{},[226,903,231],{"className":904},[229,230],[226,906,184],{"className":907},[229,236],[220,909,910],{},[182,911,241,912,915,241,917,921,241,923,927,241,929,932,224,934],{},[226,913,246],{"className":914},[229,245],[248,916],{},[226,918,920],{"className":919},[229,236],"setup-patches",[248,922],{},[226,924,926],{"className":925},[229,236],"setup-turtles",[248,928],{},[226,930,279],{"className":931},[229,245],[248,933],{},[226,935,285],{"className":936},[229,230],[41,938,939],{},[44,940,941,942,944,945,947],{},"The new definition of ",[182,943,184],{}," refers to two new procedures. To define\n",[182,946,920],{},", add this:",[220,949,950],{},[182,951,224,952,232,955],{},[226,953,231],{"className":954},[229,230],[226,956,920],{"className":957},[229,236],[220,959,960],{},[182,961,241,962,232,965,259,968,232,971,232,975,273,979,224,981],{},[226,963,620],{"className":964},[229,245],[226,966,831],{"className":967},[229,267],[226,969,782],{"className":970},[229,245],[226,972,974],{"className":973},[229,267],"pcolor",[226,976,978],{"className":977},[229,670],"green",[248,980],{},[226,982,285],{"className":983},[229,230],[22,985,986,987,989,990,997,998,1005],{},"The ",[182,988,920],{}," procedure sets the color of every patch to green to start\nwith. (A turtle’s color variable is ",[305,991,992],{"displayText":786,"permalink":786},[16,993,786],{"href":994,"className":995,"dataDisplayText":786,"rel":996,"target":315,"title":786},"/dictionary#color",[312],[314],"; a patch’s is ",[305,999,1000],{"displayText":974,"permalink":974},[16,1001,974],{"href":1002,"className":1003,"dataDisplayText":974,"rel":1004,"target":315,"title":974},"/dictionary#pcolor",[312],[314],".)",[22,1007,1008,1009,484],{},"The only part remaining in our new ‘setup’ that is still undefined is\n",[182,1010,926],{},[41,1012,1013],{},[44,1014,1015],{},"Add this procedure too:",[220,1017,1018],{},[182,1019,224,1020,232,1023],{},[226,1021,231],{"className":1022},[229,230],[226,1024,926],{"className":1025},[229,236],[220,1027,1028],{},[182,1029,241,1030,232,1033,1036,241,1038,232,1041,259,1044,232,1047,232,1050,273,1053,224,1055],{},[226,1031,253],{"className":1032},[229,245],[226,1034,258],{"className":1035},[229,257],[248,1037],{},[226,1039,620],{"className":1040},[229,245],[226,1042,624],{"className":1043},[229,267],[226,1045,263],{"className":1046},[229,245],[226,1048,268],{"className":1049},[229,267],[226,1051,272],{"className":1052},[229,267],[248,1054],{},[226,1056,285],{"className":1057},[229,230],[22,1059,1060,1061,1063,1064,1066],{},"Did you notice that the new ",[182,1062,926],{}," procedure has most of the same\ncommands as the old ",[182,1065,184],{}," procedure?",[41,1068,1069,1072],{},[44,1070,1071],{},"Switch back to the Interface tab.",[44,1073,1074],{},"Press the setup button.",[22,1076,1077,1078],{},"Voila! A lush NetLogo landscape complete with turtles and green patches appears:\n",[193,1079],{"alt":1080,"className":1081,"src":1082,"width":1083,"height":1083,"style":1084},"tutorial3/scatter-on-green.png",[197],"/_content/images/tutorial3/scatter-on-green.png",419,{"aspectRatio":1085},"419/419",[22,1087,1088,1089,1091],{},"After seeing the new ",[182,1090,184],{}," procedure work a few times, you may find it helpful\nto read through the procedure definitions again.",[135,1093,1096],{"id":1094,"className":1095},"turtle-variables",[14],[16,1097,85],{"className":1098,"href":84},[19],[22,1100,1101],{},"So we have some turtles running around on a landscape, but they aren’t doing\nanything with it. Let’s add some interaction between the turtles and the\npatches.",[22,1103,1104],{},"We’ll make the turtles eat “grass” (the green patches), reproduce, and die. The\ngrass will gradually grow back after it is eaten.",[22,1106,1107],{},"We’ll need a way of controlling when a turtle reproduces and dies. We’ll\ndetermine that by keeping track of how much “energy” each turtle has. To do that\nwe need to add a new turtle variable.",[22,1109,1110,1111,1117,1118,1126,1127,1130],{},"You’ve already seen built-in turtle variables like ",[305,1112,1113],{"displayText":786,"permalink":786},[16,1114,786],{"href":994,"className":1115,"dataDisplayText":786,"rel":1116,"target":315,"title":786},[312],[314],". To make a new\nturtle variable, we add a ",[305,1119,1121],{"displayText":1120,"permalink":1120},"turtles-own",[16,1122,1120],{"href":1123,"className":1124,"dataDisplayText":1120,"rel":1125,"target":315,"title":1120},"/dictionary#turtles-own",[312],[314]," declaration at the top of the Code\ntab, before all the procedures. Call it ",[182,1128,1129],{},"energy",":",[220,1132,1133],{},[182,1134,1135,625,1138,1141,1142,1144,232,1149,1152,1154,1155,1158,1154,1160,1164,1154,1166,1169],{},[226,1136,1120],{"className":1137},[229,230],[226,1139,1129],{"className":1140},[229,236],"]",[248,1143],{},[226,1145,1147,307],{"className":1146},[229,230],[248,1148],{},[226,1150,480],{"className":1151},[229,236],[248,1153],{},"  ",[226,1156,532],{"className":1157},[229,236],[248,1159],{},[226,1161,1163],{"className":1162},[229,236],"eat-grass",[248,1165],{},[226,1167,538],{"className":1168},[229,245],[226,1170,1172,319],{"className":1171},[229,230],[248,1173],{},[22,1175,1176,1177,1179],{},"Let’s use this newly defined variable (",[182,1178,1129],{},") to allow the turtles to eat.",[165,1181,1182,1192,1202,1224,1232,1242],{},[41,1183,1184,1186],{},[44,1185,215],{},[44,1187,1188,1189,1191],{},"Rewrite the ",[182,1190,480],{}," procedure as follows:",[220,1193,1194],{},[182,1195,224,1196,232,1199],{},[226,1197,231],{"className":1198},[229,230],[226,1200,480],{"className":1201},[229,236],[220,1203,1204],{},[182,1205,241,1206,1209,241,1211,1214,241,1216,1219,224,1221],{},[226,1207,532],{"className":1208},[229,236],[248,1210],{},[226,1212,1163],{"className":1213},[229,236],[248,1215],{},[226,1217,538],{"className":1218},[229,245],[248,1220],{},[226,1222,285],{"className":1223},[229,230],[41,1225,1226],{},[44,1227,1228,1229,1231],{},"Add a new ",[182,1230,1163],{}," procedure:",[220,1233,1234],{},[182,1235,224,1236,232,1239],{},[226,1237,231],{"className":1238},[229,230],[226,1240,1163],{"className":1241},[229,236],[220,1243,1244],{},[182,1245,241,1246,232,1249,625,1252,628,1254,232,1258,232,1261,232,1265,625,1268,1270,1271,232,1274,232,1277,1281,1270,1283,232,1286,232,1289,232,1292,232,1296,1300,1302,1303,653,1305,224,1307],{},[226,1247,620],{"className":1248},[229,245],[226,1250,624],{"className":1251},[229,267],[248,1253],{},[226,1255,1257],{"className":1256},[229,245],"if",[226,1259,974],{"className":1260},[229,267],[226,1262,1264],{"className":1263},[229,267],"=",[226,1266,978],{"className":1267},[229,670],[248,1269],{},"          ",[226,1272,782],{"className":1273},[229,245],[226,1275,974],{"className":1276},[229,267],[226,1278,1280],{"className":1279},[229,670],"black",[248,1282],{},[226,1284,782],{"className":1285},[229,245],[226,1287,1129],{"className":1288},[229,236],[226,1290,1129],{"className":1291},[229,236],[226,1293,1295],{"className":1294},[229,267],"+",[226,1297,1299],{"className":1298},[229,257],"10",[248,1301],{},"        ]",[248,1304],{},[248,1306],{},[226,1308,285],{"className":1309},[229,230],[22,1311,1312,1313,1320,1321,1327,1328,1330,1331,1334],{},"We are using the ",[305,1314,1315],{"displayText":1257,"permalink":1257},[16,1316,1257],{"href":1317,"className":1318,"dataDisplayText":1257,"rel":1319,"target":315,"title":1257},"/dictionary#if",[312],[314]," command for the first time. Look at the code carefully.\nEach turtle, when it runs these commands, compares the value of the patch color\nit is on (",[305,1322,1323],{"displayText":974,"permalink":974},[16,1324,974],{"href":1002,"className":1325,"dataDisplayText":974,"rel":1326,"target":315,"title":974},[312],[314],") to the value for ",[182,1329,978],{},". (A turtle has direct access to\nthe variables of the patch it is standing on.) If the patch color is green, the\ncomparison reports ",[182,1332,1333],{},"true",", and only then will the turtle run the commands inside\nthe brackets (otherwise it skips them). The commands make the turtle change the\npatch color to black and increase its own energy by 10. The patch turns black to\nsignify that the grass at that spot has been eaten. And the turtle is given more\nenergy, from having just eaten.",[22,1336,1337],{},"Next, let’s make the movement of turtles use up some of the turtle’s energy.",[165,1339,1340,1348,1358],{},[41,1341,1342],{},[44,1343,1344,1345,1347],{},"Rewrite ",[182,1346,532],{}," as follows:",[220,1349,1350],{},[182,1351,224,1352,232,1355],{},[226,1353,231],{"className":1354},[229,230],[226,1356,532],{"className":1357},[229,236],[220,1359,1360],{},[182,1361,241,1362,232,1365,625,1368,628,1370,232,1373,232,1376,1379,628,1381,232,1384,1387,628,1389,232,1392,232,1395,232,1398,232,1401,1404,653,1406,224,1408],{},[226,1363,620],{"className":1364},[229,245],[226,1366,624],{"className":1367},[229,267],[248,1369],{},[226,1371,632],{"className":1372},[229,245],[226,1374,636],{"className":1375},[229,267],[226,1377,640],{"className":1378},[229,257],[248,1380],{},[226,1382,646],{"className":1383},[229,245],[226,1385,650],{"className":1386},[229,257],[248,1388],{},[226,1390,782],{"className":1391},[229,245],[226,1393,1129],{"className":1394},[229,236],[226,1396,1129],{"className":1397},[229,236],[226,1399,675],{"className":1400},[229,267],[226,1402,650],{"className":1403},[229,257],[248,1405],{},[248,1407],{},[226,1409,285],{"className":1410},[229,230],[22,1412,1413],{},"As each turtle wanders, it will lose one unit of energy at each step.",[165,1415,1416,1421],{},[41,1417,1418],{},[44,1419,1420],{},"Switch to the Interface tab now and press the setup button and the go\nbutton.",[22,1422,1423,1424],{},"You’ll see the patches turn black as turtles travel over them.\n",[193,1425],{"alt":1426,"className":1427,"src":1428,"width":1429,"height":426,"style":1430},"tutorial3/eating-grass.png",[197],"/_content/images/tutorial3/eating-grass.png",421,{"aspectRatio":1431},"421/420",[135,1433,1436],{"id":1434,"className":1435},"monitors",[14],[16,1437,91],{"className":1438,"href":90},[19],[22,1440,1441],{},"Next you will create two monitors in the Interface tab with the toolbar. (You\nmake them just like buttons and sliders, using the Add icon on the toolbar.)\nLet’s make the first monitor now.",[165,1443,1444,1449,1454],{},[41,1445,1446],{},[44,1447,1448],{},"Create a monitor by clicking the Add icon on the toolbar, selecting Monitor\nnext to it, and clicking on an open spot in the Interface.",[22,1450,1453],{"className":1451},[1452],"question","A dialog box will appear.",[41,1455,1456,1469],{},[44,1457,1458,1459,1468],{},"In the dialog type: ",[182,1460,1461,232,1465],{},[226,1462,1464],{"className":1463},[229,267],"count",[226,1466,624],{"className":1467},[229,267]," (see image below).",[44,1470,1471],{},"Press the OK button to close the dialog.",[22,1473,1474],{},[193,1475],{"alt":1476,"className":1477,"src":1478,"width":294,"height":1479,"style":1480},"tutorial3/monitor-1.png",[197],"/_content/images/tutorial3/monitor-1.png",362,{"aspectRatio":1481},"556/362",[22,1483,1484,1491,1492,1499],{},[305,1485,1486],{"displayText":624,"permalink":624},[16,1487,624],{"href":1488,"className":1489,"dataDisplayText":624,"rel":1490,"target":315,"title":624},"/dictionary#turtles",[312],[314]," is an “agentset”, the set of all turtles. ",[305,1493,1494],{"displayText":1464,"permalink":1464},[16,1495,1464],{"href":1496,"className":1497,"dataDisplayText":1464,"rel":1498,"target":315,"title":1464},"/dictionary#count",[312],[314]," tells us how\nmany agents are in that set.",[22,1501,1502],{},"Let’s make the second monitor now:",[165,1504,1505,1509,1512],{},[41,1506,1507],{},[44,1508,1448],{},[22,1510,1453],{"className":1511},[1452],[41,1513,1514,1538,1549],{},[44,1515,1516,1517,1468],{},"In the Reporter section of the dialog box type:\n",[182,1518,1519,232,1522,232,1525,625,1529,232,1532,232,1535,1141],{},[226,1520,1464],{"className":1521},[229,267],[226,1523,831],{"className":1524},[229,267],[226,1526,1528],{"className":1527},[229,267],"with",[226,1530,974],{"className":1531},[229,267],[226,1533,1264],{"className":1534},[229,267],[226,1536,978],{"className":1537},[229,670],[44,1539,1540,1541],{},"In the Display name section of the dialog box type: ",[182,1542,1543,232,1546],{},[226,1544,978],{"className":1545},[229,670],[226,1547,831],{"className":1548},[229,267],[44,1550,1551],{},"Press the OK button to close the dialog box.",[22,1553,1554],{},[193,1555],{"alt":1556,"className":1557,"src":1558,"width":1559,"height":1560,"style":1561},"tutorial3/monitor-2.png",[197],"/_content/images/tutorial3/monitor-2.png",672,368,{"aspectRatio":1562},"672/368",[22,1564,1565,1566,1572,1573,1580,1581,1588,1589,1600],{},"Here we’re using ",[305,1567,1568],{"displayText":1464,"permalink":1464},[16,1569,1464],{"href":1496,"className":1570,"dataDisplayText":1464,"rel":1571,"target":315,"title":1464},[312],[314]," again to see how many agents are in an agentset.\n",[305,1574,1575],{"displayText":831,"permalink":831},[16,1576,831],{"href":1577,"className":1578,"dataDisplayText":831,"rel":1579,"target":315,"title":831},"/dictionary#patches",[312],[314]," is the set of all the patches, but we don’t just want to know how\nmany patches there are total, we want to know how many of them are green. That’s\nwhat ",[305,1582,1583],{"displayText":1528,"permalink":1528},[16,1584,1528],{"href":1585,"className":1586,"dataDisplayText":1528,"rel":1587,"target":315,"title":1528},"/dictionary#with",[312],[314]," does; it makes a smaller agentset of just those agents for whom\nthe condition in the brackets is true. The condition is ",[182,1590,1591,232,1594,232,1597],{},[226,1592,974],{"className":1593},[229,267],[226,1595,1264],{"className":1596},[229,267],[226,1598,978],{"className":1599},[229,670],", so\nthat gives us just the green patches.",[22,1602,1603],{},"Now we have two monitors that will report how many turtles and green patches we\nhave, to help us track what’s going on in our model. As the model runs, the\nnumbers in the monitors will automatically change.",[165,1605,1606],{},[41,1607,1608],{},[44,1609,1610],{},"Use the setup and go buttons and watch the numbers in the monitors change.",[135,1612,1615],{"id":1613,"className":1614},"switches-and-labels",[14],[16,1616,97],{"className":1617,"href":96},[19],[22,1619,1620],{},"The turtles aren’t just turning the patches black. They’re also gaining and\nlosing energy. As the model runs, try using a turtle monitor to watch one\nturtle’s energy go up and down.",[22,1622,1623],{},"It would be nicer if we could see every turtle’s energy all the time. We will\nnow do exactly that, and add a switch so we can turn the extra visual\ninformation on and off.",[165,1625,1626,1637,1641],{},[41,1627,1628,1631,1634],{},[44,1629,1630],{},"Click on the Add icon on the toolbar (in the Interface tab).",[44,1632,1633],{},"Select Switch from the menu next to Add.",[44,1635,1636],{},"Click on an open spot in the interface.",[22,1638,1640],{"className":1639},[1452],"A dialog will appear.",[41,1642,1643],{},[44,1644,1645,1646,1649],{},"Into the Global variable field, type ",[182,1647,1648],{},"show-energy?"," Don’t forget to include\nthe question mark in the name. (See image below.)",[22,1651,1652],{},[193,1653],{"alt":1654,"className":1655,"src":1656,"width":1657,"height":1658,"style":1659},"tutorial3/switch.png",[197],"/_content/images/tutorial3/switch.png",643,268,{"aspectRatio":1660},"643/268",[165,1662,1663,1672,1682],{},[41,1664,1665,1668],{},[44,1666,1667],{},"Now go back to the ‘go’ procedure using the Code tab with the Toolbar.",[44,1669,1188,1670,1191],{},[182,1671,1163],{},[220,1673,1674],{},[182,1675,224,1676,232,1679],{},[226,1677,231],{"className":1678},[229,230],[226,1680,1163],{"className":1681},[229,236],[220,1683,1684],{},[182,1685,241,1686,232,1689,625,1692,628,1694,232,1697,232,1700,232,1703,625,1706,1270,1708,232,1711,232,1714,1717,1270,1719,232,1722,232,1725,232,1728,232,1731,1734,1302,1736,628,1738,232,1742,1745,1747,1748,232,1751,232,1755,273,1758,1747,1760,232,1763,232,1766,273,1771,653,1773,224,1775],{},[226,1687,620],{"className":1688},[229,245],[226,1690,624],{"className":1691},[229,267],[248,1693],{},[226,1695,1257],{"className":1696},[229,245],[226,1698,974],{"className":1699},[229,267],[226,1701,1264],{"className":1702},[229,267],[226,1704,978],{"className":1705},[229,670],[248,1707],{},[226,1709,782],{"className":1710},[229,245],[226,1712,974],{"className":1713},[229,267],[226,1715,1280],{"className":1716},[229,670],[248,1718],{},[226,1720,782],{"className":1721},[229,245],[226,1723,1129],{"className":1724},[229,236],[226,1726,1129],{"className":1727},[229,236],[226,1729,1295],{"className":1730},[229,267],[226,1732,1299],{"className":1733},[229,257],[248,1735],{},[248,1737],{},[226,1739,1741],{"className":1740},[229,245],"ifelse",[226,1743,1648],{"className":1744},[229,236],[248,1746],{},"          [ ",[226,1749,782],{"className":1750},[229,245],[226,1752,1754],{"className":1753},[229,267],"label",[226,1756,1129],{"className":1757},[229,236],[248,1759],{},[226,1761,782],{"className":1762},[229,245],[226,1764,1754],{"className":1765},[229,267],[226,1767,1770],{"className":1768},[229,1769],"string","\"\"",[248,1772],{},[248,1774],{},[226,1776,285],{"className":1777},[229,230],[22,1779,986,1780,1782,1783,1790,1791,1793],{},[182,1781,1163],{}," procedure introduces the ",[305,1784,1785],{"displayText":1741,"permalink":1741},[16,1786,1741],{"href":1787,"className":1788,"dataDisplayText":1741,"rel":1789,"target":315,"title":1741},"/dictionary#ifelse",[312],[314]," command. Look at the code\ncarefully. Each turtle, when it runs these new commands, checks the value of\n",[182,1792,1648],{}," (determined by the switch). If the switch is on, comparison is\ntrue and the turtle will run the commands inside the first set of brackets. In\nthis case, it assigns the value for the energy to the label of the turtle. If\nthe comparison is false (the switch is off) then the turtle runs the commands\ninside the second set of brackets. In this case, it removes the text labels (by\nsetting the label of the turtle to be nothing).",[22,1795,1796],{},"(In NetLogo, a piece of text is called a “string”, short for string of\ncharacters. A string is a sequence of letters or other characters, written\nbetween double quotes. Here we have two double quotes right next to each other,\nwith nothing in between them. That’s an empty string. If a turtle’s label is an\nempty string, no text is attached to the turtle.)",[165,1798,1799],{},[41,1800,1801],{},[44,1802,1803,1804,1806],{},"Test this in the Interface tab, by running the model (using the setup and go\nbuttons) switching the ",[182,1805,1648],{}," switch back and forth.",[22,1808,1809,1810],{},"When the switch is on, you’ll see the energy of each turtle go up each time it\neats grass. You’ll also see its energy going down whenever it moves.\n",[193,1811],{"alt":1812,"className":1813,"src":1814,"width":426,"height":426,"style":1815},"tutorial3/show-energy.png",[197],"/_content/images/tutorial3/show-energy.png",{"aspectRatio":428},[135,1817,1820],{"id":1818,"className":1819},"more-procedures",[14],[16,1821,103],{"className":1822,"href":102},[19],[22,1824,1825],{},"Now our turtles are eating. Let’s make them reproduce and die, too. And let’s\nmake the grass grow back. We’ll add all three of these of these behaviors now,\nby making three separate procedures, one for each behavior.",[165,1827,1828,1837,1847,1887,1900,1910],{},[41,1829,1830,1833],{},[44,1831,1832],{},"Go to the Code tab.",[44,1834,1188,1835,1191],{},[182,1836,480],{},[220,1838,1839],{},[182,1840,224,1841,232,1844],{},[226,1842,231],{"className":1843},[229,230],[226,1845,480],{"className":1846},[229,236],[220,1848,1849],{},[182,1850,241,1851,1854,241,1856,1859,241,1861,1865,241,1867,1871,241,1873,1877,241,1879,1882,224,1884],{},[226,1852,532],{"className":1853},[229,236],[248,1855],{},[226,1857,1163],{"className":1858},[229,236],[248,1860],{},[226,1862,1864],{"className":1863},[229,236],"reproduce",[248,1866],{},[226,1868,1870],{"className":1869},[229,236],"check-death",[248,1872],{},[226,1874,1876],{"className":1875},[229,236],"regrow-grass",[248,1878],{},[226,1880,538],{"className":1881},[229,245],[248,1883],{},[226,1885,285],{"className":1886},[229,230],[41,1888,1889],{},[44,1890,1891,1892,793,1894,1896,1897,1899],{},"Add the procedures for ",[182,1893,1864],{},[182,1895,1870],{},", and ",[182,1898,1876],{}," as\nshown below:",[220,1901,1902],{},[182,1903,224,1904,232,1907],{},[226,1905,231],{"className":1906},[229,230],[226,1908,1864],{"className":1909},[229,236],[220,1911,1912],{},[182,1913,241,1914,232,1917,625,1920,628,1922,232,1925,232,1928,232,1932,625,1936,1270,1938,232,1941,232,1944,232,1947,232,1950,1953,1270,1955,232,1959,259,1962,232,1965,232,1968,273,1971,1302,1973,653,1975,224,1977,1980,1982,224,1984,232,1987,1990,241,1992,232,1995,625,1998,628,2000,232,2003,232,2006,232,2010,259,2014,273,2018,653,2020,224,2022,2025,2027,224,2029,232,2032,2035,241,2037,232,2040,625,2043,628,2045,232,2048,232,2051,232,2054,232,2058,259,2062,232,2065,232,2068,273,2071,653,2073,224,2075],{},[226,1915,620],{"className":1916},[229,245],[226,1918,624],{"className":1919},[229,267],[248,1921],{},[226,1923,1257],{"className":1924},[229,245],[226,1926,1129],{"className":1927},[229,236],[226,1929,1931],{"className":1930},[229,267],">",[226,1933,1935],{"className":1934},[229,257],"50",[248,1937],{},[226,1939,782],{"className":1940},[229,245],[226,1942,1129],{"className":1943},[229,236],[226,1945,1129],{"className":1946},[229,236],[226,1948,675],{"className":1949},[229,267],[226,1951,1935],{"className":1952},[229,257],[248,1954],{},[226,1956,1958],{"className":1957},[229,245],"hatch",[226,1960,650],{"className":1961},[229,257],[226,1963,782],{"className":1964},[229,245],[226,1966,1129],{"className":1967},[229,236],[226,1969,1935],{"className":1970},[229,257],[248,1972],{},[248,1974],{},[248,1976],{},[226,1978,285],{"className":1979},[229,230],[248,1981],{},[248,1983],{},[226,1985,231],{"className":1986},[229,230],[226,1988,1870],{"className":1989},[229,236],[248,1991],{},[226,1993,620],{"className":1994},[229,245],[226,1996,624],{"className":1997},[229,267],[248,1999],{},[226,2001,1257],{"className":2002},[229,245],[226,2004,1129],{"className":2005},[229,236],[226,2007,2009],{"className":2008},[229,267],"\u003C=",[226,2011,2013],{"className":2012},[229,257],"0",[226,2015,2017],{"className":2016},[229,245],"die",[248,2019],{},[248,2021],{},[226,2023,285],{"className":2024},[229,230],[248,2026],{},[248,2028],{},[226,2030,231],{"className":2031},[229,230],[226,2033,1876],{"className":2034},[229,236],[248,2036],{},[226,2038,620],{"className":2039},[229,245],[226,2041,831],{"className":2042},[229,267],[248,2044],{},[226,2046,1257],{"className":2047},[229,245],[226,2049,636],{"className":2050},[229,267],[226,2052,258],{"className":2053},[229,257],[226,2055,2057],{"className":2056},[229,267],"\u003C",[226,2059,2061],{"className":2060},[229,257],"3",[226,2063,782],{"className":2064},[229,245],[226,2066,974],{"className":2067},[229,267],[226,2069,978],{"className":2070},[229,670],[248,2072],{},[248,2074],{},[226,2076,285],{"className":2077},[229,230],[22,2079,2080,2081,2087,2088,2090,2091,2098],{},"Each of these procedures uses the ",[305,2082,2083],{"displayText":1257,"permalink":1257},[16,2084,1257],{"href":1317,"className":2085,"dataDisplayText":1257,"rel":2086,"target":315,"title":1257},[312],[314]," command. Each turtle, when it runs\n",[182,2089,1870],{}," it will check to see if its energy is less or equal to 0. If this\nis true, then the turtle is told to ",[305,2092,2093],{"displayText":2017,"permalink":2017},[16,2094,2017],{"href":2095,"className":2096,"dataDisplayText":2017,"rel":2097,"target":315,"title":2017},"/dictionary#die",[312],[314]," (die is a NetLogo primitive).",[22,2100,2101,2102,2104,2105,2107,2108,2115,2116,232,2118,232,2121,2126,2127,2129,2130,2132],{},"When each turtle runs ",[182,2103,1864],{},", it checks the value of the turtle’s ",[182,2106,1129],{},"\nvariable. If it is greater than 50, then the turtle runs the commands inside the\nfirst set of brackets. In this case, it decreases the turtle’s energy by 50,\nthen ‘hatches’ a new turtle with an energy of 50. The ",[305,2109,2110],{"displayText":1958,"permalink":1958},[16,2111,1958],{"href":2112,"className":2113,"dataDisplayText":1958,"rel":2114,"target":315,"title":1958},"/dictionary#hatch",[312],[314]," command is a\nNetLogo primitive which looks like this: ",[182,2117,1958],{},[2119,2120,257],"em",{},[226,2122,232,2123],{},[2119,2124,2125],{},"commands",". This\nturtle creates ",[2119,2128,257],{}," new turtles, each identical to its parent, and asks the\nnew turtle(s) that have been hatched to run ",[2119,2131,2125],{},". You can use the commands\nto give the new turtles different colors, headings, or whatever. In our case we\nrun one command. We set the energy for the newly hatched turtle to be 50.",[22,2134,2135,2136,2138],{},"When each patch runs ",[182,2137,1876],{}," it will check to see if a random integer\nfrom 0 to 99 is less than 3. If so, the patch color is set to green. This will\nhappen 3% of the time (on average) for each patch, since there are three numbers\n(0, 1, and 2) out of 100 possible that are less than 3.",[165,2140,2141],{},[41,2142,2143],{},[44,2144,2145],{},"Switch to the Interface tab now and press the setup and go buttons.",[22,2147,2148],{},"You should see some interesting behavior in your model now. Some turtles die\noff, some new turtles are created (hatched), and some grass grows back. This is\nexactly what we set out to do.",[22,2150,2151,2152,562,2156,2159],{},"If you continue to watch your monitors in your model, you will see that the\n",[2153,2154,2155],"strong",{},"count turtles",[2153,2157,2158],{},"green patches"," monitors both fluctuate. Is this pattern\nof fluctuation predictable? Is there a relationship between the variables?",[22,2161,2162],{},"It’d be nice if we had a easier way to track the changes in the model behavior\nover time. NetLogo allows us to plot data as we go along. That will be our next\nstep.",[135,2164,2167],{"id":2165,"className":2166},"plotting",[14],[16,2168,109],{"className":2169,"href":108},[19],[22,2171,2172],{},"To make plotting work, we’ll need to create a plot in the Interface tab and put\nsome commands inside it.",[22,2174,2175,2176,2178,2179,2181,2182,2184,2185,484],{},"The commands we put in the plots will run automatically when our ",[182,2177,184],{},"\nprocedure calls ",[182,2180,279],{}," and when our ",[182,2183,480],{}," procedure calls ",[182,2186,538],{},[165,2188,2189],{},[41,2190,2191,2194,2197,2200,2203,2206,2222,2225,2228],{},[44,2192,2193],{},"Create a plot by clicking the Add icon on the toolbar, selecting Plot next\nto it, and clicking on an open spot in the Interface.",[44,2195,2196],{},"Set its Name to “Totals” (see image below)",[44,2198,2199],{},"Set the X axis label to “time”",[44,2201,2202],{},"Set the Y axis label to “totals”",[44,2204,2205],{},"Change the name of the “default” pen to “turtles”.",[44,2207,2208,2209,2221],{},"Enter ",[182,2210,2211,232,2215,232,2218],{},[226,2212,2214],{"className":2213},[229,245],"plot",[226,2216,1464],{"className":2217},[229,267],[226,2219,624],{"className":2220},[229,267]," under Pen Update Commands.",[44,2223,2224],{},"Press the “Add Pen” button.",[44,2226,2227],{},"Change the name of the new pen to “grass”.",[44,2229,2208,2230,2221],{},[182,2231,2232,232,2235,232,2238,232,2241,625,2244,232,2247,232,2250,1141],{},[226,2233,2214],{"className":2234},[229,245],[226,2236,1464],{"className":2237},[229,267],[226,2239,831],{"className":2240},[229,267],[226,2242,1528],{"className":2243},[229,267],[226,2245,974],{"className":2246},[229,267],[226,2248,1264],{"className":2249},[229,267],[226,2251,978],{"className":2252},[229,670],[22,2254,2255,2256],{},"When you’re done, the dialog should look like this: ",[193,2257],{"alt":2258,"className":2259,"src":2260,"width":2261,"height":2262,"style":2263},"tutorial3/totals.png",[197],"/_content/images/tutorial3/totals.png",648,552,{"aspectRatio":2264},"648/552",[165,2266,2267],{},[41,2268,2269],{},[44,2270,2271],{},"Press OK in the Plot dialog to finish editing.",[22,2273,2274],{},"Note that when you create the plot you can also set the minimum and maximum\nvalues on the X and Y axes. You’ll want to leave the “Auto Scale” checkbox\nchecked, so that if anything you plot exceeds the minimum and maximum values for\nthe axes, the axes will automatically grow so you can see all the data.",[22,2276,2277,2278,2285],{},"Note that we used the ",[305,2279,2280],{"displayText":2214,"permalink":2214},[16,2281,2214],{"href":2282,"className":2283,"dataDisplayText":2214,"rel":2284,"target":315,"title":2214},"/dictionary#plot",[312],[314]," command to add the next point to a plot. This\ncommand moves the current plot pen to the point that has an X coordinate equal\nto 1 greater than the previously plotted X coordinate and a Y coordinate equal\nto the value given in the plot command (in the first case, the number of\nturtles, and in the second case, the number of green patches). As the pens move\nthey each draw a line.",[165,2287,2288],{},[41,2289,2290],{},[44,2291,2292],{},"Setup and run the model again.",[22,2294,2295],{},"You can now watch the plot being drawn as the model is running. Your plot should\nhave the general shape of the one below, though your plot might not look exactly\nthe same.",[22,2297,2298,2299],{},"Remember that we left “Auto Scale?” on. This allows the plot to readjust itself\nwhen it runs out of room. ",[193,2300],{"alt":2301,"className":2302,"src":2303,"width":2304,"height":2305,"style":2306},"tutorial3/plotwindow.png",[197],"/_content/images/tutorial3/plotwindow.png",213,165,{"aspectRatio":2307},"213/165",[22,2309,2310],{},"If you forget which pen is which, you can edit the plot and check the “Show\nlegend?” checkbox.",[22,2312,2313],{},"You might try running the model several times to see what aspects of the plot\nare the same and which are different from run to run.",[135,2315,2318],{"id":2316,"className":2317},"tick-counter",[14],[16,2319,115],{"className":2320,"href":114},[19],[22,2322,2323,2324,2326],{},"To make comparisons between plots from one model run and another, it is often\nuseful to do the comparison for the same length of model run. Learning how to\nstop or start an action at a specific time can help make this happen by stopping\nthe model at the same point each model run. Keeping track of how many times the\n",[182,2325,480],{}," procedure is run is a useful way to cue these actions. That’s what the tick\ncounter does.",[22,2328,2329,2330,2332,2333,2335],{},"You’re already using the tick counter in your model, with the ",[182,2331,279],{}," and\n",[182,2334,538],{}," commands, which also trigger plotting.",[22,2337,2338],{},"You can also use the tick counter for other things, such as to set a limit on\nthe total length of a run.",[165,2340,2341,2348,2358,2416],{},[41,2342,2343],{},[44,2344,2345,2346,1231],{},"Change the ",[182,2347,480],{},[220,2349,2350],{},[182,2351,224,2352,232,2355],{},[226,2353,231],{"className":2354},[229,230],[226,2356,480],{"className":2357},[229,236],[220,2359,2360],{},[182,2361,241,2362,232,2365,232,2369,232,2373,259,2377,273,2381,241,2383,2386,241,2388,2391,241,2393,2396,241,2398,2401,241,2403,2406,241,2408,2411,224,2413],{},[226,2363,1257],{"className":2364},[229,245],[226,2366,2368],{"className":2367},[229,267],"ticks",[226,2370,2372],{"className":2371},[229,267],">=",[226,2374,2376],{"className":2375},[229,257],"500",[226,2378,2380],{"className":2379},[229,245],"stop",[248,2382],{},[226,2384,532],{"className":2385},[229,236],[248,2387],{},[226,2389,1163],{"className":2390},[229,236],[248,2392],{},[226,2394,1870],{"className":2395},[229,236],[248,2397],{},[226,2399,1864],{"className":2400},[229,236],[248,2402],{},[226,2404,1876],{"className":2405},[229,236],[248,2407],{},[226,2409,538],{"className":2410},[229,245],[248,2412],{},[226,2414,285],{"className":2415},[229,230],[41,2417,2418],{},[44,2419,2420],{},"Now setup and run the model.",[22,2422,2423],{},"The graph and model won’t keep running forever. They should stop automatically\nwhen the tick counter in the Interface tab’s toolbar reaches 500.",[22,2425,986,2426,2432,2433,2440,2441,2448,2449,2451],{},[305,2427,2428],{"displayText":538,"permalink":538},[16,2429,538],{"href":550,"className":2430,"dataDisplayText":538,"rel":2431,"target":315,"title":538},[312],[314]," command advances the tick counter by 1. ",[305,2434,2435],{"displayText":2368,"permalink":2368},[16,2436,2368],{"href":2437,"className":2438,"dataDisplayText":2368,"rel":2439,"target":315,"title":2368},"/dictionary#ticks",[312],[314]," is a reporter\nwhich reports the current value of the tick counter. ",[305,2442,2443],{"displayText":279,"permalink":279},[16,2444,279],{"href":2445,"className":2446,"dataDisplayText":279,"rel":2447,"target":315,"title":279},"/dictionary#reset-ticks",[312],[314],", in your\n",[182,2450,184],{}," procedure, takes care of restarting the tick counter at 0 when a new run\nis set up and ready to begin.",[135,2453,2456],{"id":2454,"className":2455},"some-more-details",[14],[16,2457,121],{"className":2458,"href":120},[19],[22,2460,2461],{},"First, instead of always using 100 turtles, you can have a varying number of\nturtles.",[165,2463,2464,2487,2497],{},[41,2465,2466,2469,2472],{},[44,2467,2468],{},"Create a slider named “number”: click the Add icon on the toolbar, select\nSlider next to it, and click on an open spot in the interface.",[44,2470,2471],{},"Try changing the minimum and maximum values in the slider.",[44,2473,2474,2475,2477,2478,2486],{},"Then inside of ",[182,2476,926],{},", instead of ",[182,2479,2480,232,2483],{},[226,2481,253],{"className":2482},[229,245],[226,2484,258],{"className":2485},[229,257]," you can\ntype:",[220,2488,2489],{},[182,2490,224,2491,232,2494],{},[226,2492,231],{"className":2493},[229,230],[226,2495,926],{"className":2496},[229,236],[220,2498,2499],{},[182,2500,241,2501,232,2504,259,2507,232,2510,232,2513,273,2516,224,2518],{},[226,2502,253],{"className":2503},[229,245],[226,2505,257],{"className":2506},[229,236],[226,2508,263],{"className":2509},[229,245],[226,2511,268],{"className":2512},[229,267],[226,2514,272],{"className":2515},[229,267],[248,2517],{},[226,2519,285],{"className":2520},[229,230],[22,2522,2523],{},"Test this change and compare how having more or fewer turtles initially affect\nthe plots over time.",[22,2525,2526],{},"Second, wouldn’t it be nice to adjust the energy the turtles gain and lose as\nthey eat grass and reproduce?",[165,2528,2529,2550,2560,2653,2661,2671],{},[41,2530,2531,2537,2543],{},[44,2532,2533,2534,484],{},"Make a slider called ",[182,2535,2536],{},"energy-from-grass",[44,2538,2539,2540,484],{},"Make another slider called ",[182,2541,2542],{},"birth-energy",[44,2544,2545,2546,2549],{},"Then, inside of ",[182,2547,2548],{},"eat-grass,"," make this change:",[220,2551,2552],{},[182,2553,224,2554,232,2557],{},[226,2555,231],{"className":2556},[229,230],[226,2558,1163],{"className":2559},[229,236],[220,2561,2562],{},[182,2563,241,2564,232,2567,625,2570,628,2572,232,2575,232,2578,232,2581,625,2584,1270,2586,232,2589,232,2592,2595,1270,2597,232,2600,2603,2604,232,2607,232,2610,2613,2614,1302,2616,628,2618,232,2621,2624,1747,2626,232,2629,232,2632,273,2635,1747,2637,232,2640,232,2643,273,2646,653,2648,224,2650],{},[226,2565,620],{"className":2566},[229,245],[226,2568,624],{"className":2569},[229,267],[248,2571],{},[226,2573,1257],{"className":2574},[229,245],[226,2576,974],{"className":2577},[229,267],[226,2579,1264],{"className":2580},[229,267],[226,2582,978],{"className":2583},[229,670],[248,2585],{},[226,2587,782],{"className":2588},[229,245],[226,2590,974],{"className":2591},[229,267],[226,2593,1280],{"className":2594},[229,670],[248,2596],{},[226,2598,782],{"className":2599},[229,245],[226,2601,1129],{"className":2602},[229,236]," (",[226,2605,1129],{"className":2606},[229,236],[226,2608,1295],{"className":2609},[229,267],[226,2611,2536],{"className":2612},[229,236],")",[248,2615],{},[248,2617],{},[226,2619,1741],{"className":2620},[229,245],[226,2622,1648],{"className":2623},[229,236],[248,2625],{},[226,2627,782],{"className":2628},[229,245],[226,2630,1754],{"className":2631},[229,267],[226,2633,1129],{"className":2634},[229,236],[248,2636],{},[226,2638,782],{"className":2639},[229,245],[226,2641,1754],{"className":2642},[229,267],[226,2644,1770],{"className":2645},[229,1769],[248,2647],{},[248,2649],{},[226,2651,285],{"className":2652},[229,230],[41,2654,2655],{},[44,2656,2657,2658,2660],{},"And, inside of ",[182,2659,1864],{},", make this change:",[220,2662,2663],{},[182,2664,224,2665,232,2668],{},[226,2666,231],{"className":2667},[229,230],[226,2669,1864],{"className":2670},[229,236],[220,2672,2673],{},[182,2674,241,2675,232,2678,625,2681,628,2683,232,2686,232,2689,232,2692,625,2695,1270,2697,232,2700,232,2703,232,2706,232,2709,2712,1270,2714,232,2717,259,2720,232,2723,232,2726,273,2729,1302,2731,653,2733,224,2735],{},[226,2676,620],{"className":2677},[229,245],[226,2679,624],{"className":2680},[229,267],[248,2682],{},[226,2684,1257],{"className":2685},[229,245],[226,2687,1129],{"className":2688},[229,236],[226,2690,1931],{"className":2691},[229,267],[226,2693,2542],{"className":2694},[229,236],[248,2696],{},[226,2698,782],{"className":2699},[229,245],[226,2701,1129],{"className":2702},[229,236],[226,2704,1129],{"className":2705},[229,236],[226,2707,675],{"className":2708},[229,267],[226,2710,2542],{"className":2711},[229,236],[248,2713],{},[226,2715,1958],{"className":2716},[229,245],[226,2718,650],{"className":2719},[229,257],[226,2721,782],{"className":2722},[229,245],[226,2724,1129],{"className":2725},[229,236],[226,2727,2542],{"className":2728},[229,236],[248,2730],{},[248,2732],{},[248,2734],{},[226,2736,285],{"className":2737},[229,230],[22,2739,2740],{},"Finally, what other slider could you add to vary how often grass grows back? Are\nthere rules you can add to the movement of the turtles or to the newly hatched\nturtles that happen only at certain times? Try writing them.",[135,2742,2745],{"id":2743,"className":2744},"whats-next",[14],[16,2746,127],{"className":2747,"href":126},[19],[22,2749,2750],{},"So now you have a simple model of an ecosystem. Patches grow grass. Turtles\nwander, eat the grass, reproduce, and die.",[22,2752,2753],{},"You have created an interface containing buttons, sliders, switches, monitors,\nand a plot. You’ve even written a series of procedures to give the turtles\nsomething to do.",[22,2755,2756],{},"That’s where this tutorial leaves off.",[22,2758,2759,2760,2764,2765,2769,2770,484],{},"If you’d like to look at some more documentation about NetLogo, the\n",[16,2761,2763],{"href":2762},"interface","Interface Guide"," section of the manual walks you through every\nelement of the NetLogo interface in order and explains its function. For a\ndetailed description and specifics about writing procedures, refer to the\n",[16,2766,2768],{"href":2767},"/programming","Programming Guide",". All of the primitives are listed and\ndescribed in the ",[16,2771,2773],{"href":2772},"dictionary","NetLogo Dictionary",[22,2775,2776],{},"Also, you can continue experimenting with and expanding this model if you’d\nlike, experimenting with different variables and behaviors for the agents.",[22,2778,2779,2780,2790],{},"Alternatively, you may want to revisit the first model in the tutorial, Wolf\nSheep Predation. This is the model you used in ",[182,2781,2782,232,2786],{},[226,2783,2785],{"className":2784},[229,236],"Tutorial",[226,2787,2789],{"className":2788},[229,236],"#1",". In the Wolf Sheep\nPredation model, you saw sheep move around, consume resources that are\nreplenished occasionally (grass), reproduce under certain conditions, and die if\nthey ran out of resources. But that model had another type of creature moving\naround — wolves. The addition of wolves requires some additional procedures and\nsome new primitives. Wolves and sheep are two different “breeds” of turtle. To\nsee how to use breeds, study Wolf Sheep Predation.",[22,2792,2793],{},"Alternatively, you can look at other models (including the many models in the\nCode Examples section of the Models Library) or even go ahead and build your own\nmodel. You don’t even have to model anything. It can be interesting just to\nwatch patches and turtles forming patterns, to try to create a game to play, or\nwhatever.",[22,2795,2796],{},"Hopefully you have learned some things, both in terms of the NetLogo language\nand about how to go about building a model. The entire set of procedures that\nwas created above is shown below.",[135,2798,2801],{"id":2799,"className":2800},"appendix-complete-code",[14],[16,2802,133],{"className":2803,"href":132},[19],[22,2805,2806],{},"The complete model is also available in NetLogo’s Models Library, in the Code\nExamples section. It’s called “Tutorial 3”.",[22,2808,2809],{},"Notice that this listing is full of “comments”, which begin with semicolons.\nComments let you mix an explanation the code right in with the code itself. You\nmight use comments to help others understand your model, or you might use them\nas notes to yourself.",[22,2811,2812],{},"In the Code tab, comments are gray, so your eyes can pick them out easily.",[220,2814,2815],{},[182,2816,2817,625,2820,2823,2824,2829,2831,2832,2836,2838,232,2843,2846,1154,2848,2851,1154,2853,2856,1154,2858,2861,1154,2863,2866,2871,2873,232,2878,2881,1154,2883,232,2886,259,2889,232,2892,232,2895,273,2898,2903,2905,232,2910,2913,1154,2915,232,2918,2921,2922,2926,1154,2928,232,2931,259,2934,232,2937,232,2940,273,2943,2948,2950,232,2955,2958,1154,2960,232,2963,232,2966,232,2969,259,2972,2975,2976,2980,1154,2982,2985,1154,2987,2990,1154,2992,2995,1154,2997,3000,1154,3002,3005,1154,3007,3010,3011,3015,3020,3022,232,3027,3030,1154,3032,232,3035,625,3038,2921,3040,232,3043,232,3046,3049,2921,3051,232,3054,3057,2921,3059,232,3062,232,3065,232,3068,232,3071,1154,3074,3078,3080,3081,3086,3088,232,3093,3096,1154,3098,232,3101,625,3104,2921,3106,232,3109,232,3112,232,3115,625,3118,241,3120,232,3123,232,3126,3129,3131,3132,3136,241,3138,232,3141,232,3144,232,3147,232,3150,3153,3155,3156,1154,3158,232,3161,3164,3166,3167,232,3170,232,3173,3176,3177,3181,3166,3183,232,3186,232,3189,3192,3193,3197,3080,3199,3204,3206,232,3211,3214,1154,3216,232,3219,625,3222,2921,3224,232,3227,232,3230,232,3233,625,3236,241,3238,232,3241,232,3244,232,3247,232,3250,1154,3253,3257,241,3259,232,3262,259,3265,232,3268,232,3271,3176,3274,3278,3155,3280,3080,3282,3287,3289,232,3294,3297,1154,3299,232,3302,625,3305,2921,3307,232,3310,232,3313,232,3316,259,3319,3176,3322,3326,3080,3328,3333,3335,232,3340,3343,1154,3345,232,3348,259,3351,3355,2921,3357,232,3360,232,3363,232,3366,232,3369,259,3372,232,3375,232,3378,273,3381,3080,3383],{},[226,2818,1120],{"className":2819},[229,230],[226,2821,1129],{"className":2822},[229,236],"] ",[226,2825,2828],{"className":2826},[229,2827],"comment",";; for keeping track of when the turtle is ready",[248,2830],{},"                     ",[226,2833,2835],{"className":2834},[229,2827],";; to reproduce and when it will die",[248,2837],{},[226,2839,2841,307],{"className":2840},[229,230],[248,2842],{},[226,2844,184],{"className":2845},[229,236],[248,2847],{},[226,2849,246],{"className":2850},[229,245],[248,2852],{},[226,2854,920],{"className":2855},[229,236],[248,2857],{},[226,2859,926],{"className":2860},[229,236],[248,2862],{},[226,2864,279],{"className":2865},[229,245],[226,2867,2869,319],{"className":2868},[229,230],[248,2870],{},[248,2872],{},[226,2874,2876,307],{"className":2875},[229,230],[248,2877],{},[226,2879,920],{"className":2880},[229,236],[248,2882],{},[226,2884,620],{"className":2885},[229,245],[226,2887,831],{"className":2888},[229,267],[226,2890,782],{"className":2891},[229,245],[226,2893,974],{"className":2894},[229,267],[226,2896,978],{"className":2897},[229,670],[226,2899,2901,319],{"className":2900},[229,230],[248,2902],{},[248,2904],{},[226,2906,2908,307],{"className":2907},[229,230],[248,2909],{},[226,2911,926],{"className":2912},[229,236],[248,2914],{},[226,2916,253],{"className":2917},[229,245],[226,2919,257],{"className":2920},[229,236],"    ",[226,2923,2925],{"className":2924},[229,2827],";; uses the value of the number slider to create turtles",[248,2927],{},[226,2929,620],{"className":2930},[229,245],[226,2932,624],{"className":2933},[229,267],[226,2935,263],{"className":2936},[229,245],[226,2938,268],{"className":2939},[229,267],[226,2941,272],{"className":2942},[229,267],[226,2944,2946,319],{"className":2945},[229,230],[248,2947],{},[248,2949],{},[226,2951,2953,307],{"className":2952},[229,230],[248,2954],{},[226,2956,480],{"className":2957},[229,236],[248,2959],{},[226,2961,1257],{"className":2962},[229,245],[226,2964,2368],{"className":2965},[229,267],[226,2967,2372],{"className":2968},[229,267],[226,2970,2376],{"className":2971},[229,257],[226,2973,2380],{"className":2974},[229,245]," ]  ",[226,2977,2979],{"className":2978},[229,2827],";; stop after 500 ticks",[248,2981],{},[226,2983,532],{"className":2984},[229,236],[248,2986],{},[226,2988,1163],{"className":2989},[229,236],[248,2991],{},[226,2993,1870],{"className":2994},[229,236],[248,2996],{},[226,2998,1864],{"className":2999},[229,236],[248,3001],{},[226,3003,1876],{"className":3004},[229,236],[248,3006],{},[226,3008,538],{"className":3009},[229,245],"                    ",[226,3012,3014],{"className":3013},[229,2827],";; increase the tick counter by 1 each time through",[226,3016,3018,319],{"className":3017},[229,230],[248,3019],{},[248,3021],{},[226,3023,3025,307],{"className":3024},[229,230],[248,3026],{},[226,3028,532],{"className":3029},[229,236],[248,3031],{},[226,3033,620],{"className":3034},[229,245],[226,3036,624],{"className":3037},[229,267],[248,3039],{},[226,3041,632],{"className":3042},[229,245],[226,3044,636],{"className":3045},[229,267],[226,3047,640],{"className":3048},[229,257],[248,3050],{},[226,3052,646],{"className":3053},[229,245],[226,3055,650],{"className":3056},[229,257],[248,3058],{},[226,3060,782],{"className":3061},[229,245],[226,3063,1129],{"className":3064},[229,236],[226,3066,1129],{"className":3067},[229,236],[226,3069,675],{"className":3070},[229,267],[226,3072,650],{"className":3073},[229,257],[226,3075,3077],{"className":3076},[229,2827],";; when the turtle moves it looses one unit of energy",[248,3079],{},"  ]",[226,3082,3084,319],{"className":3083},[229,230],[248,3085],{},[248,3087],{},[226,3089,3091,307],{"className":3090},[229,230],[248,3092],{},[226,3094,1163],{"className":3095},[229,236],[248,3097],{},[226,3099,620],{"className":3100},[229,245],[226,3102,624],{"className":3103},[229,267],[248,3105],{},[226,3107,1257],{"className":3108},[229,245],[226,3110,974],{"className":3111},[229,267],[226,3113,1264],{"className":3114},[229,267],[226,3116,978],{"className":3117},[229,670],[248,3119],{},[226,3121,782],{"className":3122},[229,245],[226,3124,974],{"className":3125},[229,267],[226,3127,1280],{"className":3128},[229,670],[248,3130],{},"           ",[226,3133,3135],{"className":3134},[229,2827],";; the value of energy-from-grass slider is added to energy",[248,3137],{},[226,3139,782],{"className":3140},[229,245],[226,3142,1129],{"className":3143},[229,236],[226,3145,1129],{"className":3146},[229,236],[226,3148,1295],{"className":3149},[229,267],[226,3151,2536],{"className":3152},[229,236],[248,3154],{},"    ]",[248,3157],{},[226,3159,1741],{"className":3160},[229,245],[226,3162,1648],{"className":3163},[229,236],[248,3165],{},"    [ ",[226,3168,782],{"className":3169},[229,245],[226,3171,1754],{"className":3172},[229,267],[226,3174,1129],{"className":3175},[229,236]," ] ",[226,3178,3180],{"className":3179},[229,2827],";; the label is set to be the value of the energy",[248,3182],{},[226,3184,782],{"className":3185},[229,245],[226,3187,1754],{"className":3188},[229,267],[226,3190,1770],{"className":3191},[229,1769]," ]     ",[226,3194,3196],{"className":3195},[229,2827],";; the label is set to an empty text value",[248,3198],{},[226,3200,3202,319],{"className":3201},[229,230],[248,3203],{},[248,3205],{},[226,3207,3209,307],{"className":3208},[229,230],[248,3210],{},[226,3212,1864],{"className":3213},[229,236],[248,3215],{},[226,3217,620],{"className":3218},[229,245],[226,3220,624],{"className":3221},[229,267],[248,3223],{},[226,3225,1257],{"className":3226},[229,245],[226,3228,1129],{"className":3229},[229,236],[226,3231,1931],{"className":3232},[229,267],[226,3234,2542],{"className":3235},[229,236],[248,3237],{},[226,3239,782],{"className":3240},[229,245],[226,3242,1129],{"className":3243},[229,236],[226,3245,1129],{"className":3246},[229,236],[226,3248,675],{"className":3249},[229,267],[226,3251,2542],{"className":3252},[229,236],[226,3254,3256],{"className":3255},[229,2827],";; take away birth-energy to give birth",[248,3258],{},[226,3260,1958],{"className":3261},[229,245],[226,3263,650],{"className":3264},[229,257],[226,3266,782],{"className":3267},[229,245],[226,3269,1129],{"className":3270},[229,236],[226,3272,2542],{"className":3273},[229,236],[226,3275,3277],{"className":3276},[229,2827],";; give this birth-energy to the offspring",[248,3279],{},[248,3281],{},[226,3283,3285,319],{"className":3284},[229,230],[248,3286],{},[248,3288],{},[226,3290,3292,307],{"className":3291},[229,230],[248,3293],{},[226,3295,1870],{"className":3296},[229,236],[248,3298],{},[226,3300,620],{"className":3301},[229,245],[226,3303,624],{"className":3304},[229,267],[248,3306],{},[226,3308,1257],{"className":3309},[229,245],[226,3311,1129],{"className":3312},[229,236],[226,3314,2009],{"className":3315},[229,267],[226,3317,2013],{"className":3318},[229,257],[226,3320,2017],{"className":3321},[229,245],[226,3323,3325],{"className":3324},[229,2827],";; removes the turtle if it has no energy left",[248,3327],{},[226,3329,3331,319],{"className":3330},[229,230],[248,3332],{},[248,3334],{},[226,3336,3338,307],{"className":3337},[229,230],[248,3339],{},[226,3341,1876],{"className":3342},[229,236],[248,3344],{},[226,3346,620],{"className":3347},[229,245],[226,3349,831],{"className":3350},[229,267],[226,3352,3354],{"className":3353},[229,2827],";; 3 out of 100 times, the patch color is set to green",[248,3356],{},[226,3358,1257],{"className":3359},[229,245],[226,3361,636],{"className":3362},[229,267],[226,3364,258],{"className":3365},[229,257],[226,3367,2057],{"className":3368},[229,267],[226,3370,2061],{"className":3371},[229,257],[226,3373,782],{"className":3374},[229,245],[226,3376,974],{"className":3377},[229,267],[226,3379,978],{"className":3380},[229,670],[248,3382],{},[226,3384,3386,319],{"className":3385},[229,230],[248,3387],{},{"title":3389,"searchDepth":3390,"depth":3391,"links":3392},"",5,3,[3393,3395,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410],{"id":33,"depth":3394,"text":39},4,{"id":137,"depth":3396,"text":49},2,{"id":156,"depth":3396,"text":55},{"id":437,"depth":3396,"text":61},{"id":463,"depth":3396,"text":67},{"id":762,"depth":3396,"text":73},{"id":880,"depth":3396,"text":79},{"id":1094,"depth":3396,"text":85},{"id":1434,"depth":3396,"text":91},{"id":1613,"depth":3396,"text":97},{"id":1818,"depth":3396,"text":103},{"id":2165,"depth":3396,"text":109},{"id":2316,"depth":3396,"text":115},{"id":2454,"depth":3396,"text":121},{"id":2743,"depth":3396,"text":127},{"id":2799,"depth":3396,"text":133},"Third tutorial in the NetLogo learning series, focusing on creating and using procedures in NetLogo programming.","md",{"source":3414,"metadataOutputPath":3415,"projectConfig":3416,"language":3423,"inheritFrom":3432,"output":3431,"version":3417,"keywords":3433,"tags":3437,"icon":3438,"assetsRoot":3439},"autogen/tutorial3.md","content/tutorial3.metadata.yaml",{"version":3417,"projectRoot":484,"scanRoot":3418,"outputRoot":3419,"defaults":3420,"engine":3426,"partials":3427,"dedupeIdenticalDiskWrites":3431},"7.0.4","autogen","content",{"inheritFrom":3421,"language":3423,"output":3424,"extension":3412,"title":3425,"version":3417},[3422],0,"en",false,"NetLogo User Manual","handlebars",{"directoryPaths":3428,"extensions":3429},[484],[3430,3412],"mustache",true,[3422],[2785,3434,3435,3436],"Procedures","Advanced Programming","NetLogo",[2785,3434,3435],"i-fluent-mdl2-learning-tools","/home/runner/work/Helio/Helio/apps/docs/autogen","/tutorial3",{"title":5,"description":3411},"tutorial3","zIjeksLUqeu3Ku6qDNLs96cfMnSMOy--TqY9P004_QE",[3445,3450],{"title":3446,"path":3447,"stem":3448,"description":3449},"Tutorial #2: Commands","/tutorial2","tutorial2","Second tutorial in the NetLogo learning series, covering basic commands and programming concepts in NetLogo.",{"title":3451,"path":3452,"stem":3453,"description":3454},"Version History","/versions","versions","History of NetLogo versions, including release notes, changes, and feature additions across different releases.",1777657788516]