Metric_update

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Child of model Final_Project_Addiction
Model group MAM-2016 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0-M5 • Viewed 135 times • Downloaded 14 times • Run 0 times
Download the 'Metric_update' 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

breed [drugs a-drug]
breed [people person]

globals [work-bool eat-bool take-drug-bool]

people-own [money job-class dopamine-level times-done days-since-drug risk-behavior]

to setup
  ca
  create-people 20 [
    setxy random-xcor random-ycor
    set shape "person"
    set size 1.4
    let job random 3
    set job-class job + 1 ;; 1 = poor, 2 = middle class, 3 = upper class
    ifelse job-class = 1 [set money random 100] [ ifelse job-class = 2
      [set money random 100 + 100 ] [set money random 100 + 200]]
    set dopamine-level 100
    set times-done 0
    set risk-behavior random 100
  ]
  create-drugs 20 [setxy random-xcor random-ycor set shape "circle" set size .5]
  reset-ticks
end 

to go
  ask people [
    let current-enhancer work-change
    set work-bool True
    let temp-enhancer eat-change
    if temp-enhancer > current-enhancer [
      set current-enhancer temp-enhancer
      set work-bool False
      set eat-bool True
    ]
    set temp-enhancer drug-change
    if temp-enhancer > current-enhancer [
      set current-enhancer temp-enhancer
      set eat-bool False
      set take-drug-bool True
    ]
    ifelse work-bool [ show "current enhancer is work" work] [
      ifelse eat-bool [show "current enhancer is eat" eat ] [ show "current enhancer is drugs" do-drugs]
    ]
  ]
end 

to walk
  rt 90
  lt 90
  fd 1
end 

to-report work-change
  ;; less you have, harder you work, more energy it takes
  let temp-dopamine dopamine-level - (energy-of-job / job-class)
  let temp-money money + (job-class * energy-of-job)
  report temp-dopamine + (temp-money / job-class) ;; people who are already rich get less return from working
end 

to-report eat-change
  let temp-dopamine dopamine-level + energy-from-food
  let temp-money money - cost-of-food
  ifelse temp-money > 0 [report temp-dopamine + temp-money] [show "could not afford" report 0]
end 

to-report drug-change
  let temp-times-done 0
  ifelse days-since-drug > 20 [set temp-times-done 1][set temp-times-done times-done + 1]
  let temp-dopamine dopamine-level + (drug-potency / temp-times-done)
  let temp-money money - (cost-of-drug * temp-times-done)
  report temp-dopamine + risk-behavior + temp-money
end 

to work
  set money money + (job-class * energy-of-job)
  set dopamine-level dopamine-level - (energy-of-job / job-class)
  set days-since-drug days-since-drug + 1
end 

to eat
  set money money - cost-of-food
  set dopamine-level dopamine-level + energy-from-food
  set days-since-drug days-since-drug + 1
end 

;; drugs decreases your money and increases your dopamine-level but the amount goes down each time you
;; do it because your tolerance raises so each time you do it the cost also increases bc you have to buy more

to do-drugs
  ifelse days-since-drug > 20 [ set times-done 1 ] [ set times-done times-done + 1 ]
  set money money - (cost-of-drug * times-done)
  set dopamine-level dopamine-level + (drug-potency / times-done)
  set days-since-drug 0
end 


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

Attached files

No files

Parent: Final_Project_Addiction

This model does not have any descendants.

Graph of models related to 'Metric_update'