# Pursuit

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## WHAT IS IT?

In this model there is one leader turtle and a group of follower turtles. Have a little fun -- hide the leader and try to guess the path it's moving along. Watching the followers gives you clues to the leader's path.

## HOW IT WORKS

The leader moves along a path according to a preselected formula, such as y = x ^ 2.

The leader starts at the left edge of the world.

The leader always moves from left to right by one unit increments along the x-axis. Be aware, for several functions, however, the function is scaled by some factor so that its shape fits well within the world.

The leader's y coordinate is based on the selected formula and the current x coordinate. For example, if the current formula is y = x ^ 2 and the leader's current xcor value is -3, the ycor value will be set to 9.

Each follower turns to face the leader, then moves forward by a fixed amount.

## HOW TO USE IT

Use the NUM-FOLLOWERS slider to select how many followers will pursue the leader. If exactly four followers are selected, they will be placed at the four corners of the world. If a different number is selected, the followers will be placed at random locations in the world.

Use the STEP-SIZE slider to decide how far from its current location a follower will move after each step of the leader.

When you press SETUP, the light gray lines that appear are the x-axis and the y-axis.

Leader Switches:

SHOW-LEADER? makes the leader shown or hidden. This switch must be set before SETUP is pressed.

When the switch is set to on, the leader will be visible.

When the switch is set to off, the leader will be hidden.

SHOW-TRAIL?, when turned on, causes the leader to leave a mark at each location determined by its formula. This switch may be turned on and off at any time during the pursuit.

When the switch is set to on, the trail will be visible.

When the switch is set to off, the trail will be hidden.

Press RANDOM or any of the function buttons when all of the above selections have been made. This will create the leader and the selected number of followers.

RANDOM chooses a random function for the leader to follow, and is best used with SHOW-LEADER? and SHOW-TRAIL? turned off so that the function can be guessed based on the movements of the followers.

The other buttons choose a specific function for the leader to follow.

Press GO-ONCE to make the leader increment its xcor value by one and to make the followers take one step toward the leader.

Press GO to make the leader and followers move continuously.

To stop them, press the GO button again.

The SLOWDOWN slider controls how fast all of the turtles move.

Press REVEAL after the model is done to see what the path of the leader was if SHOW-TRAIL? was turned off. You can use this to check your guess as to what the function was.

## HOW TO USE IT

Try starting with 4 followers with a step size of 1. Do not show the leader or the leader's trail.

Use settings so that the world is square.

Press RANDOM then press GO.

See if you can guess the formula the leader is using by observing the path of each follower.

For each of the next questions, consider the follow-up questions "Why or why not?" and "How can you tell?"

Does the speed of the leader seem to change over time?

Does the speed of a follower seem to change over time?

Do all followers travel at the same speed?

What can you tell about the leader's formula based on the path of each follower?

What traits of each follower's path give you information about the leader's formula? Which of these traits do you find most helpful? Why?

To change the formula for the leader:

A number of formulas have been stored in the procedures for this model. To explicitly make a given formula active, choose the button for the formula you want instead of RANDOM.

See the EXTENDING THE MODEL section for instructions on how to add your own formulas to the model.

## THINGS TO NOTICE

There are several characteristics of each follower's path and the leader's trail that are worth noting.

Follower Path Slope:

What does it mean if the slope of the path is increasing?

What does it mean if the slope of the path is decreasing?

What does it mean if one section of the path has a steeper slope than another part?

What does it mean if the slope of the path is constant?

To think about the slope of a path, consider whether the path appears to be going 'uphill' or 'downhill' and consider whether the 'hill' is steep or flat.

Follower Path Concavity:

What does it mean if the path has a section that is concave up?

What does it mean if the path has a section that is concave down?

What does it mean if the path has sections of both of these types?

What does it mean if the path has neither concave up nor concave down sections?

A path that is concave up will be shaped like part of an upright coffee cup.

A path that is concave down will be shaped like part of an upside down coffee cup.

Relationships Between Paths:

Do the paths have any symmetry? Would you expect them to? Why or why not?

Distances Between the Leader and a Follower:

Once you have determined the formula for the leader, run a simulation with the leader's trail turned on. (Note that there are other suggestions to verify your answer in the THINGS TO TRY section. Make sure you have tried at least some of these before you show the trail. If you show the trail before you are really sure you are right, you might end up spoiling all your fun- there's no going back once you have seen the trail of the leader!)

Find a path where a follower seems to get close to the leader only to have the leader appear to speed up and escape from the follower.

Why does this happen? What kinds of generalizations can you make about the formulas or relationships for which this happens?

How do the distances between the leader's trail marks relate to the perceived speed of the leader?

Leader Mark Proximity:

Depending on the path that the leader is following, the leader's trail marks may not be evenly spaced.

What does it mean when the steps are evenly spaced?

What does it mean when the steps are not evenly spaced?

What does it mean when the marks are closer together?

What does it mean when the marks are further apart?

## THINGS TO TRY

Try moving followers to specific locations after SETUP has been pressed but before GO has been pressed. Make predictions about how different locations would be helpful.

What can you learn if a follower starts in any of the following locations?

- along the right edge of the world
- along the left edge of the world
- along the top edge of the world
- along the bottom edge of the world
- along the x-axis
- along the y-axis
- at the origin

What is the most helpful first location for a follower? (The location on top of the leader is, of course, out of the question!)

What is the most helpful follow-up location for a single follower or for a group of followers?

Come up with a strategy for placing followers so that you can determine the path of the leader fairly quickly. Describe your strategy.

You may use the command center, or the turtle window to move a follower. The leader is turtle 0, the followers are all turtles with who > 0.

Try increasing the number of followers.

(Even if you think you have the formula figured out, try using larger NUM-FOLLOWERS values before you show the leader or the leader's trail. )

Why does using a larger NUM-FOLLOWERS value make it easier to guess the leader's formula?

Try increasing the STEP-SIZE of the followers.

(Even if you think you have the formula figured out, try using larger STEP-SIZE values before you show the leader or the leader's trail. )

Why does using a larger STEP-SIZE value make it easier to guess the leader's formula?

The above discussions all involve trying to guess the path of the leader. Alternately, you can know the formula of the leader and try to guess the paths of the followers.

If you know a leader's formula and are trying to guess the pattern of the followers' paths, make sure to record you guess before you run the simulation. Compare your predicted results with the actual results.

- What reasoning led you to correct predictions?
- What assumptions that you made need to be revised?

## EXTENDING THE MODEL

To add your own formulas, you need to add a new Leader Procedure to the model (the others are declared at the bottom of the Code tab.

Add your formula to the current list.

- Within the set of commands you may need to scale the y-axis to keep the leader from wrapping. (See for example, the cubic function.)
- You must restrict the domain of the leader if your formula has values for which it would be undefined. (See, for example, the logarithm function.)
- Add formula-name to the MOVE-LEADER procedure and add a button for the choice.
- Increment the number after
`random`

in the RANDOM button code to add your function to the list of possible functions that RANDOM will choose.

In this simulation, the leader uses only integer x coordinates. For which formulas might the results be different if the leader moved along smaller intervals?

What would happen if the STEP-SIZE of the followers was always set to equal the distance the leader traveled during its most recent step?

Adjust the procedures so that rectangular worlds do not cause unexpected wrapping.

Do any of these changes impact answers to any of the questions asked above?

Create leader functions and pick a follower location to get the following shapes in the follower's path:

- a straight line with positive slope
- a straight line with negative slope
- a horizontal line
- a loop
- a circle
- a curve with one "hump"
- a curve with two "humps"
- a curve with three "humps"
- a curve with n "humps"

## NETLOGO FEATURES

Turtle pens are used to draw the followers' paths.

The `stamp`

command is used to draw the leader's path.

The `face`

command is used to orient the followers.

## HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

- Wilensky, U. (1998). NetLogo Pursuit model. http://ccl.northwestern.edu/netlogo/models/Pursuit. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

## COPYRIGHT AND LICENSE

Copyright 1998 Uri Wilensky.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

## Comments and Questions

breed [ leaders leader ] breed [ followers follower ] globals [ choice the-leader ] ;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setup Procedures ;;; ;;;;;;;;;;;;;;;;;;;;;;;; to setup [n] clear-all set choice n setup-axes setup-leader setup-followers reset-ticks end to setup-axes ;; draw x-axis & y-axis as light gray ask patches with [pxcor = 0 or pycor = 0] [ set pcolor gray - 3 ] end to setup-leader create-leaders 1 [ set the-leader self set color gray + 2 set size 3 set shape "circle" set xcor min-pxcor if not show-leader? [ ht ] update-leader-ycor ] end to setup-followers create-followers num-followers [ ;; if there are exactly 4 follower turtles, set them up in the four corners of the world ;; otherwise, make the followers' locations random set color color + 10 ifelse num-followers = 4 [ ask turtle 1 [ setxy max-pxcor max-pycor ] ask turtle 2 [ setxy max-pxcor min-pycor ] ask turtle 3 [ setxy min-pxcor max-pycor ] ask turtle 4 [ setxy min-pxcor min-pycor ] ] [ setxy ((random (2 * max-pxcor)) + min-pxcor) ((random (2 * max-pxcor)) + min-pxcor) ] set shape "circle" set size 2 set pen-size 2 pd ] end to reveal let old-value-of-show-trail? show-trail? set show-trail? true ask the-leader [ set xcor 0 while [xcor < max-pxcor] [ move-leader ] st ] set show-trail? old-value-of-show-trail? end ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Runtime Procedures ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;; to go ;; stop if the lead turtle is about to go out of the world if [patch-at 1 0] of the-leader = nobody [ stop ] go-once end to go-once move-leader move-followers tick end to move-followers ask followers [ face the-leader ;; if we're about to catch up with the leader, don't pass the ;; leader, only pull even with it ifelse distance the-leader > step-size [ fd step-size ] [ move-to the-leader ] ] end to move-leader ask the-leader [ update-leader-ycor if show-trail? [ set size 1 stamp set size 3 ] set xcor xcor + 1 ] end to update-leader-ycor ;; leader procedure if (choice = 0) [ linear ] ;; y = x if (choice = 1) [ quad-up ] ;; y = x^2 if (choice = 2) [ quad-down ] ;; y = -x^2 if (choice = 3) [ cubic ] ;; y = x^3 if (choice = 4) [ logarithm ] ;; y = ln x if (choice = 5) [ exponential ] ;; y = a^x if (choice = 6) [ sine ] ;; y = sin x if (choice = 7) [ cosine ] ;; y = cos x if (choice = 8) [ hyperbolic ] ;; y = 1/x if (choice = 9) [ horizontal ] ;; y = 0 end to linear ;; leader procedure set ycor xcor end to quad-up ;; leader procedure set ycor ((xcor ^ 2) / max-pycor) end to quad-down ;; leader procedure set ycor ((- (xcor ^ 2)) / max-pycor) end to cubic ;; leader procedure set ycor ((xcor ^ 3) / (max-pycor ^ 2)) end to logarithm ;; leader procedure if (xcor <= 0) [ set xcor 1 ] set ycor ((ln (xcor / 10)) * 10) end to exponential ;; leader procedure let scale-factor ((1.1 ^ max-pxcor) / max-pycor) set ycor ((1.1 ^ xcor) / scale-factor) end to sine ;; leader procedure set ycor (max-pycor * (sin (xcor * 4))) end to cosine ;; leader procedure set ycor (max-pycor * (cos (xcor * 4))) end to hyperbolic ;; leader procedure ifelse (xcor = 0) [ set ycor 0 ] [ set ycor (max-pycor / xcor) ] end to horizontal ;; leader procedure set ycor 0 end ; Copyright 1998 Uri Wilensky. ; See Info tab for full copyright and license.

There are 10 versions of this model.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Pursuit.png | preview | Preview for 'Pursuit' | about 10 years ago, by Uri Wilensky | Download |

This model does not have any ancestors.

This model does not have any descendants.