Diffusion Final MIHS

Diffusion Final MIHS preview image

1 collaborator

Default-person Aedan McCall (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.1 • Viewed 128 times • Downloaded 13 times • Run 0 times
Download the 'Diffusion Final MIHS' 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 [ Numberofcollisions ]

to setup

  clear-all
    set Numberofcollisions 0
  create-turtles Molecules [ setxy random-xcor random-ycor ] ;figure out how to set
  ;the turtles to spawn within a confined space without just infinitely bouncing off each other
  reset-ticks
end 

to go
  move-turtles
  if ticks >= 500 [ stop ]
  collisioncheck

  tick
end 

to move-turtles
  ask turtles [
    right random 1
    forward 1

  ]
end 

to collisioncheck
  ask turtles [
    if patch-at dx 0 = nobody [
  set heading (- heading)
]
if patch-at 0 dy = nobody [
  set heading (180 - heading)
]
    ;Check to see if the turtle is at the edge of the world; if so, then the turtle turns around
     let nearby-turtles nobody
     set nearby-turtles turtles in-radius 2
      if any? nearby-turtles [

        let chosen-turtle [who] of one-of nearby-turtles
      ;face one-of nearby-turtles
      if chosen-turtle != [who] of self [
      face turtle chosen-turtle
      rt 180
      forward 1
           set Numberofcollisions Numberofcollisions + 1
      ]
     ]

    ]
end 

There is only one version of this model, created over 7 years ago by Aedan McCall.

Attached files

File Type Description Last updated
Diffusion Final MIHS.png preview Preview for 'Diffusion Final MIHS' over 7 years ago, by Aedan McCall Download

This model does not have any ancestors.

This model does not have any descendants.