Formation of happiness

Formation of happiness preview image

1 collaborator

Default-person Hossein Sabzian (Author)

Tags

social science 

Tagged by Hossein Sabzian about 1 year ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 199 times • Downloaded 8 times • Run 0 times
Download the 'Formation of happiness' 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

turtles-own [attitude]

to setup
 ca
  resize-world -22 22 -22 22  ;; size of the world
  set-patch-size 10  ;; size of each patch
  crt num-of-people [
    setxy random-xcor random-ycor  ;; spatial distribution of agents
    set attitude type-of-attitude  ;; there are 6 types of attitudes and each agent only selects one of them randomly
    set shape "face neutral"       ;; there is no happy or sad agent in the initial conditions
  ]

  reset-ticks
end 

to go

  ask turtles [


    let target one-of other turtles-here  ;; select somebody to talk with

    ifelse (target != nobody )

    [
      ifelse (attitude = [attitude] of target) [ set shape "face happy" ask target [ set shape "face happy"] ] ;; if there is a target with simmilar attitude, become happy and ask him or her to become happy

    [ set shape "face sad" ask target [set shape "face sad"]  leave ] ;; if there is a target with dissimmilar attitude, become sad and ask him or her to become sad, then leave that place

    ]

    [ search-to-find-a-target ]  ;; if there is no target, search to find somebody to talk with


    ]

  tick
end 

to-report type-of-attitude
  report one-of [
    1  ;; attitude 1
    2  ;; attitude 2
    3  ;; attitude 3
    4  ;; attitude 4
    5  ;; attitude 5
    6  ;; attitude 6
  ]
end 

to leave
  fd 1
end 

to search-to-find-a-target
  rt random 90
  lt random 90
  fd 1
  if not any? other turtles-here [search-to-find-a-target] ;; if there is no one; continue to find a targer
end 

There is only one version of this model, created over 1 year ago by Hossein Sabzian.

Attached files

File Type Description Last updated
Formation of happiness.png preview Preview for 'Formation of happiness' over 1 year ago, by Hossein Sabzian Download

This model does not have any ancestors.

This model does not have any descendants.