Basic Ant

Basic Ant preview image

1 collaborator

Brewer-2011-gr Steven Brewer (Author)

Tags

biol312 

Tagged by Steven Brewer over 4 years ago

Parent of 1 model: Less Basic Ant
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 294 times • Downloaded 18 times • Run 0 times
Download the 'Basic Ant' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

globals [radius]

to setup
  clear-all
  set radius max-pxcor - 2
  ;; make a turtle to draw our boundary
  create-turtles 1 [
    ;; move to edge of circle
    fd radius
    ;; turn to face clockwise
    rt 90
    ;; go along the arc and make the patches blue
    repeat 360 [arc-forward-by-angle 1 set pcolor 84]
    die
  ]
  ;; make a turtle to be our ant
  create-turtles 1 [
    set color red
    set size 3
    set shape "bug"
  ]
  reset-ticks
end 

to go
  ask turtles [
    ;; go forward
    fd 1
    ;; check to see if we moved into the barrier
    if pcolor = 84 [
      ;; whoops! backup and turn
      bk 1
      rt 20
    ]
  ]
  tick
end 

;; This is the procedure I borrowed.  It moves the turtle to the next point
;; on the circle, the given distance along the curve.

to arc-forward-by-angle [angle]
  ;; turn to face the next point we're going to
  rt angle / 2
  ;; calculate the distance we'll have to move forward
  ;; in order to stay on the circle. Go there.
  fd 2 * radius * sin (angle / 2)
  ;; turn to face tangent to the circle
  rt angle / 2
end 

There is only one version of this model, created over 4 years ago by Steven Brewer.

Attached files

File Type Description Last updated
Basic Ant.png preview Preview for 'Basic Ant' over 4 years ago, by Steven Brewer Download

This model does not have any ancestors.

Children:

Graph of models related to 'Basic Ant'