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

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Recently uploaded (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

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.