Election campaign simulator

Election campaign simulator preview image

1 collaborator

Iron_label_brush_2 CJ Castillo (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.0 • Viewed 336 times • Downloaded 26 times • Run 0 times
Download the 'Election campaign simulator' 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




patches-own [                                    ;; to define the attribute of the agents
  legit
]

to setup                                         ;; to set up the system
  clear-all                                      ;; clears the system to create another
  ask patches [                                  ;; the patches represent voters
    set legit random-float 1                     ;; Legit represents the attribute legitimacy preference.
    ifelse (legit <= 0.5) [                      ;; if legit value is less than or equal to 0.5, the agent is colored red. 
      set pcolor red ] [ set pcolor blue ]       ;; if legit value is greater than or equal to 0.5, the agent is colored blue.
    ]
end 

to campaign                                      ;; the agents will try to convert their neighbors. Meanwhile, every agent will also be converted by their neighbors.
  ask patches [
    let current-patch self
    ask current-patch [
      ifelse ( legit <= 0.5 ) [                  ;; if legit is less than 0.5, the agent is red and will ask its neighbor to become one by diminishing their legit value by 0.5. This process simulates the way neighbors try to discredit candidates to convert their supporters.
        ask neighbors [
          set legit (legit - 0.5)]]              ;; If legit value is greater than 0.5, the agent is blue and will ask neighbors to become one by adding 0.5 to their legit value.
      [ ask neighbors [
          set legit (legit + 0.5)]]              
      ifelse (legit <= 0.5) [
      set pcolor red ] [ set pcolor blue ]       ;; Agents change color based on the value of legit
    ]]
end 





There is only one version of this model, created almost 8 years ago by CJ Castillo.

Attached files

File Type Description Last updated
Election campaign simulator.png preview Preview for 'Election campaign simulator' almost 8 years ago, by CJ Castillo Download

This model does not have any ancestors.

This model does not have any descendants.