Mojtaba

Mojtaba preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 3D 6.4.0 • Viewed 16 times • Downloaded 2 times • Run 0 times
Download the 'Mojtaba' 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 [
  payoff-sender  ;; keeps track of sender's payoff
  payoff-receiver ;; keeps track of receiver's payoff
]

breed [senders sender]
breed [receivers receiver]

senders-own [
  type ;; the type of the sender, which could be either 0 or 1
  signal ;; the signal sent by the sender, which could be either 0 or 1
]

receivers-own [
  action ;; the action taken by the receiver based on the signal received, which could be either 0 or 1
]

to setup
  clear-all
  set-default-shape senders "circle"
  set-default-shape receivers "triangle"

  ;; Create one sender and one receiver for simplicity
  create-senders 1 [
    set color blue
    setxy random-xcor random-ycor
    set type random 2 ;; type is randomly set to 0 or 1
  ]

  create-receivers 1 [
    set color red
    setxy random-xcor random-ycor
  ]

  reset-ticks
end 

to go
  ask senders [
    send-signal
  ]

  ask receivers [
    interpret-signal
  ]

  calculate-payoffs
  tick
end 

to send-signal
  ifelse type = 0 [
    set signal 0  ;; Sender of type 0 sends signal 0
  ][
    set signal 1  ;; Sender of type 1 sends signal 1
  ]
end 

to interpret-signal
  if [signal] of one-of senders = 0 [
    set action 0  ;; Receiver takes action 0 if the signal is 0
  ][
    set action 1  ;; Receiver takes action 1 if the signal is 1
  ]
end 

to calculate-payoffs
  let sender one-of senders
  let receiver one-of receivers

  ;; Simple payoff calculation based on matching of type and action
  if [type] of sender = [action] of receiver [
    set payoff-sender payoff-sender + 1
    set payoff-receiver payoff-receiver + 1
  ] [
    set payoff-sender payoff-sender - 1
    set payoff-receiver payoff-receiver - 1
  ]

  ;; Display the payoffs
  show payoffs
end 

to-report payoffs
  report (word "Sender Payoff: " payoff-sender "  Receiver Payoff: " payoff-receiver)
end 

There is only one version of this model, created 29 days ago by Mojtaba Neishabouri.

Attached files

File Type Description Last updated
Mojtaba.png preview Preview for 'Mojtaba' 29 days ago, by Mojtaba Neishabouri Download

This model does not have any ancestors.

This model does not have any descendants.