Child of Traffic Basic

No preview image

1 collaborator

Default-person micka borscha (Author)

Tags

traffic 

Tagged by Drew Einhorn over 4 years ago

Child of model Traffic Basic
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.0 • Viewed 526 times • Downloaded 35 times • Run 0 times
Download the 'Child of Traffic Basic' modelDownload this modelEmbed this model

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


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

globals [max-speed traffic-density road-patches]

turtles-own [ speed ]

to setup
  clear-all
  set-patch-size 20
  setup-globals
  setup-patches
  setup-cars
end 

to setup-globals
  set max-speed 1
  set traffic-density 0.3
  set road-patches patches with [pycor = 0]
end 

to setup-patches
  ask road-patches [set pcolor white]
end 

to setup-cars
  let num-cars round (traffic-density * count road-patches)
  ask n-of num-cars road-patches [sprout 1]
  ask turtles [
    set color yellow
    set heading 90
    set speed random-float 1
    ]

  ask one-of turtles [
    set size 2
    set color red ]
end 

to go
  ask turtles [
  change-speed
  forward speed ]
  wait 0.1
end 

to change-speed
  let hindrance one-of turtles-on patch-ahead 1
    ifelse (hindrance != nobody)
    [ set speed 0.80 * [speed] of hindrance ]
    [ set speed (1.1 * speed) ]
    if speed > max-speed [
    set speed max-speed ]
end 

There is only one version of this model, created about 6 years ago by micka borscha.

Attached files

No files

Parent: Traffic Basic

This model does not have any descendants.

Graph of models related to 'Child of Traffic Basic'