[Draft] Turlte Color Stop

[Draft] Turlte Color Stop preview image

1 collaborator

Default-person Pradeep Ankem (Author)

Tags

prisonbreak 

Tagged by Pradeep Ankem over 6 years ago

stop 

Tagged by Pradeep Ankem over 6 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0 • Viewed 131 times • Downloaded 12 times • Run 0 times
Download the '[Draft] Turlte Color Stop' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

turtles-own [speed]

to patch-draw
  if mouse-down?     ;; reports true or false to indicate whether mouse button is down
    [
      ;; mouse-xcor and mouse-ycor report the position of the mouse --
      ;; note that they report the precise position of the mouse,
      ;; so you might get a decimal number like 12.3, but "patch"
      ;; automatically rounds to the nearest patch
      ask patch mouse-xcor mouse-ycor
        [ set pcolor red
          display ]
    ]
end 

to setup
  setup-circle
  reset-ticks
end 

to setup-circle
  clear-all
  set-default-shape turtles "bug"
  ;; turtles should be evenly spaced around the circle
  crt 10 [
    set size 2  ;; easier to see
    set speed .35  ;; this is the size of each step the turtles take in a tick
    fd random 20  ;; move turtles to perimeter of circle
    rt random 90
    ;;fd random 40
    ;;lt random 40
      ;; turtles face tangent to the circle
  ]
end 

to go
  ;;ask patch 3 -4 [ set pcolor green ]
  ;;ask patch 4 -4 [ set pcolor green ]
  ;;ask patch 5 -4 [ set pcolor green ]

  ;; move forward then turn
  ;;ask turtles [if ticks >= 100 [stop]]
  ask turtles [if pcolor = blue [stop] fd speed rt 1 ]
  ;;ask turtles [fd random 10]
  ;;ask-concurrent turtles [
    ;;fd 1
  ;;]
  ;;ask turtles [pen-down]

  tick
end 

to change-speed
  ask turtles [set speed speed + .15]   ;; increase the step-size to .5
end 

to setup-center
  ;;clear-all
  ;; set halfedge as edge divided by two. in case edge is an odd number,
  ;; halfedge get the integer value of the division.
  let halfedge int (edge / 2)
  ask patches [
    ;; if patches are between (-halfedge,-halfedge) to (-halfedge,halfedge)...
    if pxcor = (- halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws left edge in blue
    ;; if patches are between (halfedge,-halfedge) to (halfedge,halfedge)...
    if pxcor = (0 + halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws right edge in blue
    ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)...
    ;;if pycor = (- halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge)
      ;;[ set pcolor blue ]                                ;; ... draws bottom edge in blue
    ;; if patches are between (-halfedge,halfedge) to (halfedge,halfedge)...
    if pycor = (0 + halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws upper edge in blue
  ]
  reset-ticks
end 

; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 6 years ago by Pradeep Ankem.

Attached files

File Type Description Last updated
[Draft] Turlte Color Stop.png preview Preview for '[Draft] Turlte Color Stop' over 6 years ago, by Pradeep Ankem Download

This model does not have any ancestors.

This model does not have any descendants.