voter 2

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 89 times • Downloaded 7 times • Run 0 times
Download the 'voter 2' 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 [
 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 about 7 years ago by yl tn.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.