SlideShare a Scribd company logo
1 of 6
Download to read offline
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
1
Predator and Prey
An open-ended, start-from-scratch, simulation-building activity in StarLogo Nova.
This activity is designed for users with some experience working with and extending StarLogo Nova
projects who would like to learn how to build a new project from start to finish. Rather than present
step-by-step instructions, it contains a series of small challenges paired with some commands that are
useful for completing the challenges. The result of all of the work to complete the challenges is a fully
functional, extensible predator/prey simulation.
Goals:
 Create a predator/prey model in StarLogo Nova
 Learn to start a project from scratch
 Explore new commands without fear of breaking something
 Learn essential concepts that apply to every StarLogo Nova simulation
Instructions
Read each challenge and examine any commands or features that are given to help complete the
challenge. Then try to complete the challenge in any way you want to. Do not be afraid to explore and
make mistakes! Use any commands or features you want to use, but if you are stuck make sure to look
at what is supplied with the challenge. Feel free to ask your neighbors for help, but always make sure to
make your own mistakes first.
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
2
Challenge 1
Make a predator breed and a prey breed. Write a setup code to create agents of both breeds and
scatter them.
Useful features/commands:
: Opens the Breed Editor
Remember: You do not need to use all of the blocks in this table.
Block Drawer What the agent does:
Interface Executes commands inside this block
(once, from top to bottom) when the
push button widget is pushed. Widgets
can be created using the Edit Widgets
feature.
Agents Deletes everyone including itself.
Agents Creates the specified number of agents
of the chosen breed. Each newly created
agent immediately follows the directions
the block makes them "do".
Agents Sets its location to a random position in
SpaceLand.
Agents Sets all the agents' locations to random
positions in SpaceLand
Traits Sets its trait to some value. The trait is
chosen from the drop down menu and
includes color, shape, size, etc.
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
3
Challenge 2
Make the agents (both predators and prey) move around the terrain.
Useful features/commands:
Block Drawer What the agent does:
Interface Executes commands (in a forever loop) when the
toggle button widget is turned on. When the toggle
button widget is turned off, the commands in this
block don’t run. Widgets can be created using the
Edit Widgets feature.
Movement
Agent moves according to the command.
Programmer specifies number of steps for the
forward and backwards blocks. Programmer
specifies numbers of degrees for the left by and
right by blocks.
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
4
Challenge 3
Program the predators to “eat” the prey.
Useful features/commands:
Block Drawer What the agent does:
Detection Tells the "owner" of the block what to do when
it bumps into an agent of the chosen breed. The
“owner” is an agent of the breed whose page is
where this collision block is put.
Detection Refers to the agent currently colliding with the
"owner" of the block. (Only works inside an on
collision with block)
Agents
Deletes itself.
Agents
Deletes the specified agent (use "collidee",
"nearest", or "my parent" blocks).
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
5
Challenge 4
Program two data box widgets to track the population numbers of the predator and prey agents.
Useful features/commands:
  
Block Drawer What the agent does:
Interface Assigns a value to a data box.
Interface
Returns the value of the data box
Math
Returns the value of the computed
expression.
Is the overall simulation behavior a good approximation of how things work in the real world? How
could this simulation be improved? Spend some time thinking about and discussing ways to make this
simulation more realistic. In particular, how are the population sizes being made to change? Does
either population grow? If so, how? If not, why not?
Last Updated: 7/21/14
By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to
re-distribute, re-use, and modify, on the condition that the creator is appropriately credited.
6
Challenge 5
Program your breeds to reproduce according to rules that mimic the real world. Come up with some of
your own ideas, but here are some examples to get you started:
 If a predator eats some number of prey, the predator reproduces.
 If the number of predators reaches a certain number, the predators begin to die.
 A certain percentage of predators and prey can reproduce. (use random)
 Define a new trait – “Energy” – that you can use to set certain values for each agent in setup,
and program it to automatically decrease over time and increase when the agent eats food (for
example, if the predator eats prey). The agent can only reproduce if it has enough energy.
Useful features/ commands:
Breed editor can also define new traits:
Block Drawer What the agent does:
Logic Test for something. If true, then the
agent follows the commands in the
hook.
Logic
Equal to
Less Than
Greater Than
Less Than/Equal to Greater/Equal to
Compare two quantities. Returns
either true or false.
Agents Creates the specified number of
agents of the chosen breed. Each
newly created agent immediately
follows the directions the block makes
them "do".
Traits Sets its trait to some value. The trait is
chosen from the drop down menu and
includes color, shape, size, etc.
Traits Returns the value of an agent's trait.

More Related Content

More from Barbara M. King (20)

Me gusta task
Me gusta taskMe gusta task
Me gusta task
 
Python
PythonPython
Python
 
Codesters word wall
Codesters word wallCodesters word wall
Codesters word wall
 
Codesters
CodestersCodesters
Codesters
 
Dia de los muertos
Dia de los muertosDia de los muertos
Dia de los muertos
 
Bullfighting
BullfightingBullfighting
Bullfighting
 
Robotics
RoboticsRobotics
Robotics
 
Scratch
ScratchScratch
Scratch
 
Scratch
ScratchScratch
Scratch
 
Problem solving
Problem solvingProblem solving
Problem solving
 
Do now
Do nowDo now
Do now
 
Social media
Social mediaSocial media
Social media
 
Computer Hardware
Computer HardwareComputer Hardware
Computer Hardware
 
Diadelosmuertos 2016
Diadelosmuertos 2016Diadelosmuertos 2016
Diadelosmuertos 2016
 
Facebook & vr
Facebook & vrFacebook & vr
Facebook & vr
 
Primary vs secondary sources
Primary vs secondary sourcesPrimary vs secondary sources
Primary vs secondary sources
 
Primary source examples
Primary source examplesPrimary source examples
Primary source examples
 
Topic sentences & body paragraphs
Topic sentences & body paragraphs Topic sentences & body paragraphs
Topic sentences & body paragraphs
 
Photography 101
Photography 101Photography 101
Photography 101
 
Photography class 2
Photography class 2Photography class 2
Photography class 2
 

Recently uploaded

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 

Recently uploaded (20)

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 

Snl predator prey

  • 1. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 1 Predator and Prey An open-ended, start-from-scratch, simulation-building activity in StarLogo Nova. This activity is designed for users with some experience working with and extending StarLogo Nova projects who would like to learn how to build a new project from start to finish. Rather than present step-by-step instructions, it contains a series of small challenges paired with some commands that are useful for completing the challenges. The result of all of the work to complete the challenges is a fully functional, extensible predator/prey simulation. Goals:  Create a predator/prey model in StarLogo Nova  Learn to start a project from scratch  Explore new commands without fear of breaking something  Learn essential concepts that apply to every StarLogo Nova simulation Instructions Read each challenge and examine any commands or features that are given to help complete the challenge. Then try to complete the challenge in any way you want to. Do not be afraid to explore and make mistakes! Use any commands or features you want to use, but if you are stuck make sure to look at what is supplied with the challenge. Feel free to ask your neighbors for help, but always make sure to make your own mistakes first.
  • 2. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 2 Challenge 1 Make a predator breed and a prey breed. Write a setup code to create agents of both breeds and scatter them. Useful features/commands: : Opens the Breed Editor Remember: You do not need to use all of the blocks in this table. Block Drawer What the agent does: Interface Executes commands inside this block (once, from top to bottom) when the push button widget is pushed. Widgets can be created using the Edit Widgets feature. Agents Deletes everyone including itself. Agents Creates the specified number of agents of the chosen breed. Each newly created agent immediately follows the directions the block makes them "do". Agents Sets its location to a random position in SpaceLand. Agents Sets all the agents' locations to random positions in SpaceLand Traits Sets its trait to some value. The trait is chosen from the drop down menu and includes color, shape, size, etc.
  • 3. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 3 Challenge 2 Make the agents (both predators and prey) move around the terrain. Useful features/commands: Block Drawer What the agent does: Interface Executes commands (in a forever loop) when the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the Edit Widgets feature. Movement Agent moves according to the command. Programmer specifies number of steps for the forward and backwards blocks. Programmer specifies numbers of degrees for the left by and right by blocks.
  • 4. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 4 Challenge 3 Program the predators to “eat” the prey. Useful features/commands: Block Drawer What the agent does: Detection Tells the "owner" of the block what to do when it bumps into an agent of the chosen breed. The “owner” is an agent of the breed whose page is where this collision block is put. Detection Refers to the agent currently colliding with the "owner" of the block. (Only works inside an on collision with block) Agents Deletes itself. Agents Deletes the specified agent (use "collidee", "nearest", or "my parent" blocks).
  • 5. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 5 Challenge 4 Program two data box widgets to track the population numbers of the predator and prey agents. Useful features/commands:    Block Drawer What the agent does: Interface Assigns a value to a data box. Interface Returns the value of the data box Math Returns the value of the computed expression. Is the overall simulation behavior a good approximation of how things work in the real world? How could this simulation be improved? Spend some time thinking about and discussing ways to make this simulation more realistic. In particular, how are the population sizes being made to change? Does either population grow? If so, how? If not, why not?
  • 6. Last Updated: 7/21/14 By: MIT Scheller Teacher Education Program. This work is licensed under a Creative Commons Attribution 4.0 License, which allows anyone to re-distribute, re-use, and modify, on the condition that the creator is appropriately credited. 6 Challenge 5 Program your breeds to reproduce according to rules that mimic the real world. Come up with some of your own ideas, but here are some examples to get you started:  If a predator eats some number of prey, the predator reproduces.  If the number of predators reaches a certain number, the predators begin to die.  A certain percentage of predators and prey can reproduce. (use random)  Define a new trait – “Energy” – that you can use to set certain values for each agent in setup, and program it to automatically decrease over time and increase when the agent eats food (for example, if the predator eats prey). The agent can only reproduce if it has enough energy. Useful features/ commands: Breed editor can also define new traits: Block Drawer What the agent does: Logic Test for something. If true, then the agent follows the commands in the hook. Logic Equal to Less Than Greater Than Less Than/Equal to Greater/Equal to Compare two quantities. Returns either true or false. Agents Creates the specified number of agents of the chosen breed. Each newly created agent immediately follows the directions the block makes them "do". Traits Sets its trait to some value. The trait is chosen from the drop down menu and includes color, shape, size, etc. Traits Returns the value of an agent's trait.