Competing Technologies (iPhone vs Blackberry) v3

No preview image

1 collaborator

Default-person Felix Hu (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 136 times • Downloaded 6 times • Run 0 times
Download the 'Competing Technologies (iPhone vs Blackberry) v3' 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 [customers customer]
turtles-own [group-pref tech-pref influence-by-marketing friends]
globals [iphone-resources blackberry-resources tech-iphone tech-blackberry iphone-upgrade-cost blackberry-upgrade-cost]

to setup
  clear-all
  
  set iphone-resources 0
  set blackberry-resources 0
  set tech-blackberry 0
  set tech-iphone 0
  set iphone-upgrade-cost 2000
  set blackberry-upgrade-cost 2000
  
  set-default-shape customers "circle"
  create-customers initial-customers [
    ifelse random 100 < initial-iphone-percent [
      set color orange
    ][
      set color magenta
    ]
    create-helper
  ]
  ask turtles [
    if random 100 < isolation [
      create-links
    ]
  ]
  ask patches [
    set pcolor 5
  ]
  setup-marketing
  reset-ticks
end 

to create-helper
  setxy random-xcor random-ycor
  set size .8
  set friends no-turtles
  set group-pref random 20
  set tech-pref random 20
  set influence-by-marketing random 20
end 

to go
  add-resources
  spend-resources
  
  if ticks mod 500 = 0 [
    create-customers 1 [
      create-helper
      create-links
      set-phone-choice
    ]
  ]
  if ticks mod 100000 = 0 [
    if ticks != 0 [
      ask customers [
        set-phone-choice
      ]
    ]
  ]
  tick
end 

to add-resources
  set iphone-resources iphone-resources + count turtles with [color = orange]
  set blackberry-resources blackberry-resources + count turtles with [color = magenta]
end 

to spend-resources 
  if iphone-resources > iphone-upgrade-cost [
    ifelse random iphone-tech-spending + iphone-marketing-spending < iphone-tech-spending [
      set tech-iphone tech-iphone + 1
    ][
      if any? patches with [pcolor != 109] [
        ask one-of patches with [pcolor != 109] [
          increase-iphone-patch
        ]
      ]
    ]
    set iphone-resources iphone-resources - iphone-upgrade-cost
    ;set iphone-upgrade-cost iphone-upgrade-cost * 1
  ]
  if blackberry-resources > blackberry-upgrade-cost [
    ifelse random blackberry-tech-spending + blackberry-marketing-spending < blackberry-tech-spending [
      set tech-blackberry tech-blackberry + 1
    ][
      if any? patches with [pcolor != 100] [
        ask one-of patches with [pcolor != 100] [
          increase-blackberry-patch
        ]
      ]
    ]
    set blackberry-resources blackberry-resources - blackberry-upgrade-cost
    ;set blackberry-upgrade-cost blackberry-upgrade-cost * 1
  ]
end 

to increase-iphone-patch
  let my-color pcolor
  ifelse any? neighbors with [pcolor < my-color] [
    ask one-of neighbors [
      if pcolor != 109 [
        set pcolor pcolor + 1
      ]
    ]
  ][
    ask one-of patches with [pcolor != 109] [increase-iphone-patch]
  ]
end 

to increase-blackberry-patch
  let my-color pcolor
  ifelse any? neighbors with [pcolor < my-color] [
    ask one-of neighbors [
      if pcolor != 100 [
        set pcolor pcolor - 1
      ]
    ]
  ][
    ask one-of patches with [pcolor != 100] [increase-blackberry-patch]
  ]
end 

to set-phone-choice
  let sum-of-preference group-pref + tech-pref + influence-by-marketing
  let r random sum-of-preference
  ifelse r < group-pref [
    set-according-to-neighbors
  ][
    ifelse r < tech-pref [
      set-according-to-tech
    ][
      set-according-to-marketing
    ]
  ]
end 

to set-according-to-neighbors
  let blackberry-neighbors 0
  let iphone-neighbors 0
  
  if any? friends [
    ask friends [
       ifelse color = magenta [
         set blackberry-neighbors blackberry-neighbors + 1
       ][
         set iphone-neighbors iphone-neighbors + 1
       ]
    ]
  ] 

  ifelse random blackberry-neighbors + iphone-neighbors < iphone-neighbors [
    set color orange
  ][
    set color magenta
  ]
end 

to set-according-to-tech
  ifelse random tech-iphone + tech-blackberry < tech-iphone [
    set color orange
  ][
    set color magenta
  ]
end 

to set-according-to-marketing
  ifelse random 10 < pcolor - 100 [
    set color orange
  ][
    set color magenta
  ]
end 

to setup-marketing
  ask one-of patches [
    set pcolor 104
    ask-neighbors
  ]
end 

to ask-neighbors
  let my-color pcolor
  ask neighbors [
    if pcolor = 5 [
      ifelse random 10 < 5 [
        ifelse my-color + 1 > 109 [
          set pcolor 109
        ][
          set pcolor my-color + 1
        ]
      ][
        ifelse my-color - 1 < 100 [
          set pcolor 100
        ][
          set pcolor my-color - 1
        ]
      ]
      ask-neighbors
    ]
  ]
end 

to create-links 
  if random 100 < isolation [
    set friends min-n-of random network-density turtles [distance myself]
  ]
end 

There is only one version of this model, created about 5 years ago by Felix Hu.

Attached files

File Type Description Last updated
FelixHu_June2.docx word June 2nd Progress Report about 5 years ago, by Felix Hu Download