Distance Towards and Stop Example

No preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3.2pre1 • Viewed 392 times • Downloaded 27 times • Run 0 times
Download the 'Distance Towards and Stop Example' modelDownload this modelEmbed this model

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


VERSION

$Id: Distance Towards and Stop Example.nlogo 37529 2008-01-03 20:38:02Z craig $

WHAT IS IT?

This section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [ dist ]

to setup
  ca
  ask patches [set pcolor white]
  crt 2
  ask turtles [ set size 5 fd 10]
  ask turtle 0 [ set dist distance (turtle 1) ]
end 

to go
  if (dist < min-distance ) [ stop ] ; This stops the procedure before a run time error.
  move ; If you make it dist < 1 you will get a run time error.
end 

to move
  ask turtle 0 [
    set dist distance (turtle 1) ;variable dist is set to the distance from turtle 1 to turtle 0.
    set heading towards turtle 1 ; turtle 0's heading is toward turtle 1.
    fd 1
    wait .1 ; just slows it down so you can it move.
  ]
end 

There is only one version of this model, created over 14 years ago by Uri Wilensky.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.