voters

No preview image

1 collaborator

Default-person yl tn (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 187 times • Downloaded 22 times • Run 0 times
Download the 'voters' 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 [
 total-population
 total-voted
]

breed [ voters1 voter1 ]
breed [ voters2 voter2 ]
breed [ voters3 voter3 ]
breed [ voters4 voter4 ]

turtles-own [
 participation-rate
]

voters1-own [
  voted1
]

voters2-own [
  voted2
]

voters3-own [
  voted3
]

voters4-own [
  voted4
]

to setup
  clear-all
  setup-patches
  setup-voters-1
  setup-voters-2
  setup-voters-3
  setup-voters-4
  set total-population count turtles
  set total-voted 0
  reset-ticks
end 

to go
  vote
end 

to setup-patches
end 

to setup-voters-1
  create-voters1 party-supporter-1 [
    set color red
    set shape "person"
    set heading 0
    set participation-rate participation-rate-1
    set voted1 0
  ]
  ask voters1 [
    move-to one-of patches with [pxcor < -10 and pycor < 0 and pycor >= -10 and not any? turtles-here ]
  ]
end 

to setup-voters-2
  create-voters2 party-supporter-2 [
    set color blue
    set shape "person"
    set heading 0
    set participation-rate participation-rate-2
    set voted2 0
  ]
  ask voters2 [
    move-to one-of patches with [pxcor >= -10 and pxcor < 0  and pycor < 0 and pycor >= -10 and not any? turtles-here ]
  ]
end 

to setup-voters-3
  create-voters3 party-supporter-3 [
    set color green
    set shape "person"
    set heading 0
    set participation-rate participation-rate-3
    set voted3 0
  ]
  ask voters3 [
    move-to one-of patches with [pxcor >= 1 and pxcor <= 10 and pycor < 0 and pycor >= -10 and not any? voters3-here ]
  ]
end 

to setup-voters-4
  create-voters4 party-supporter-4 [
    set color gray
    set shape "person"
    set heading 0
    set participation-rate participation-rate-4
    set voted4 0
  ]
  ask voters4 [
    move-to one-of patches with [pxcor > 10 and pxcor <= 20 and pycor < 0 and pycor >= -10 and not any? voters4-here ]
  ]
end 

to vote
  ask turtles [
    if random 100 < participation-rate [
      fd 15
      if breed = voters1 [ set voted1 voted1 + 1 ]
      if breed = voters2 [ set voted2 voted2 + 1 ]
      if breed = voters3 [ set voted3 voted3 + 1 ]
      if breed = voters4 [ set voted4 voted4 + 1 ]
    ]
  ]
  set total-voted total-voted + sum [voted1] of voters1 + sum [voted2] of voters2 + sum [voted3] of voters3 + sum [voted4] of voters4
end 

There is only one version of this model, created over 8 years ago by yl tn.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.