Charisma_Ru

Charisma_Ru preview image

1 collaborator

I-patarakin Evgeny Patarakin (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 227 times • Downloaded 8 times • Run 0 times
Download the 'Charisma_Ru' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [nw]
breed [charismatics charismatic]
breed [followers follower]

;; Наследуемые свойства харизматика
charismatics-own [
vision ;; радиус обстрела
charisma ;; харизматичность - способность склонять в свою сторону
affinity ;; сколько новых адептов может зацепить харизматик - свойство идеи
personal_affinity ;; сколько новых адептов может зацепить этот конкретный харизматик
phil ;; порода - обозначить к какому клону они относятся
hcolor ;; цвет породы
divider ;; падение харизматичности у новых членов клана
ch-speed  ;; скорость перемещения
my_boss ;; лидер, который меня привлек в группу
]
followers-own [tolerance]
globals [list_of_charismatics]

to setup
;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks
set-default-shape turtles "person"
set list_of_charismatics []
end 

to create-harismen
if not is-list? list_of_charismatics  [display user-message "Начните с кнопки Start" stop]
create-charismatics 1 [
;; харизматичность 
set vision vision-of-charismatic 
set charisma power-charisma
set ch-speed  speed

set my_boss self 

;; способность удерживать других
;; вообще - свойство идеи и оно не должно падать с передачей
set affinity haffinity
set personal_affinity affinity

;; set divider divider-of-charisma
set divider divider-of-charisma

setxy random-xcor random-ycor
set size 2

;; принадлежность к группе
set list_of_charismatics lput [who] of self list_of_charismatics 

set phil length list_of_charismatics

set heading (360 / count charismatics) + random 15

;; окраска
set hcolor item who [red lime orange green brown turquoise magenta]
set color hcolor 
;;  показывать свойства главы клана
;; set label (se  phil  harisma divider betr)
]
end 

to create-flw
create-followers folks [
set size 1.5
set color blue
setxy random-xcor random-ycor
set tolerance (power-charisma / 4) + random tlr
;; set velocity 0.3
]
update-histogram
update-plot
end 

to go
if not conflict? [if count followers = 0 [display user-message "Все черепахи объединены в группы" stop] ]
ask followers [lt random 15 rt random 15 jump 0.1 
;; bounce ;;  - если нам понадобиться отражение от стенок
]
ask charismatics  [jump ch-speed ; bounce ;; - если нам понадобиться отражение от стенок
]
ask charismatics with [(my_boss != self) and ((count my-out-links) = 0)] 
[
be_free
]
ask charismatics with [personal_affinity > 1] [take_new ]
if conflict? [
ask charismatics with [personal_affinity > 1] [take_old]
              ]
tick
update-histogram
update-plot
display
end 

to take_new
;; это я подбираю новых учеников из числа свободных
let my_vision vision
let new_group followers in-radius my_vision with [tolerance < [charisma] of myself]
;; with [(distance myself) < my_vision ] 
if  (count new_group) > 0
[

ask min-one-of  new_group [distance myself]
  [
set heading [heading] of myself  create-link-to myself
set breed  charismatics 
set label who
set my_boss myself
set vision([vision] of myself) 
set divider ([divider] of myself)
set ch-speed  ([ch-speed] of myself  )
set phil [phil] of myself
set hcolor (0.2 + [hcolor] of myself )
set color hcolor
set charisma ([charisma] of myself) / ([divider] of myself)
set affinity ([affinity] of myself) 
set personal_affinity affinity

  ]
set personal_affinity personal_affinity - 1
;; set label who
]
end 

to take_old
;; это я атакую чужих харизматиков в зоне своего влияния
let my_vision vision
;; ;; Харизматик действует в зоне своего видения
let enemy_group  charismatics in-radius my_vision  with  [phil != [phil] of myself ] 
if  (count enemy_group) > 0
[
ask min-one-of enemy_group [charisma]
[
if ([charisma] of my_boss) < ([charisma] of myself ) / 2
     [
set phil [phil] of myself 
set my_boss myself
;; set vision [vision] of myself
set ch-speed  ([ch-speed] of myself  )
ask my-out-links [die] ask my-in-links [die] create-link-to myself set heading [heading] of myself
 ]
    ]
]
end 
;;

;;

to be_free 
ask my-in-links [ask other-end [be_free]] ask my-in-links [die]  
set breed followers 
set tolerance random 5  +  random tlr 
set color white rt random 180 
end 
;;

;;;;;;;;;;;;;;;;;;;;;;;
;;;     Plotting    ;;;
;;;;;;;;;;;;;;;;;;;;;;;

to update-histogram
  set-current-plot "Histogram"
 set-plot-y-range 0 folks
  ;; set-histogram-num-bars ceiling (sqrt (count turtles))
 histogram [phil] of charismatics 
;; histogram [nw:closeness-centrality] of turtles
;; nw:page-rank
end 

to update-plot
set-current-plot "Linking"
 set-plot-y-range 0 folks
 
foreach list_of_charismatics [
 set-current-plot-pen word "pen" ? 
 plot count charismatics  with [phil = ? + 1] 
]
set-current-plot-pen "follower"
 plot count followers
end 

to bounce  ;; turtle procedure
  ; check: hitting left or right wall?
  if abs [pxcor] of patch-ahead 0.1 = max-pxcor
    ; if so, reflect heading around x axis
    [ set heading (- heading) ]
  ; check: hitting top or bottom wall?
  if abs [pycor] of patch-ahead 0.1 = max-pycor
    ; if so, reflect heading around y axis
    [ set heading (180 - heading) ]
end 

There is only one version of this model, created over 4 years ago by Evgeny Patarakin.

Attached files

File Type Description Last updated
Charisma_Ru.png preview Preview for 'Charisma_Ru' over 4 years ago, by Evgeny Patarakin Download

This model does not have any ancestors.

This model does not have any descendants.