Standing Ovation

Standing Ovation preview image

1 collaborator

Default-person Tevfik Uyar (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 102 times • Downloaded 7 times • Run 0 times
Download the 'Standing Ovation' 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 [
  kack
  ayakta?
  arkaya
]

globals [
  nufus
  basla
  bitir
  oran-ayakta
  kalkanlar
]

to setup
  clear-all
  clear-output
  spawn-by-row
  ;;show count turtles
  ask n-of cokbegenen turtles [
    set color red
    set kack 0
  ]
  ask turtles [  set label kack ]
  reset-ticks
end 

to go
  ilklerkalksin
  set basla count turtles with [color = green]
  gorvekalk
  set bitir count turtles with [color = green]

  if basla = bitir [ stop ]
  tick
end 

to ilklerkalksin
  ask turtles [
    if kack = 0 [
      set color yellow
      set ayakta? true
    ]
  ]
end 

to gorvekalk

  ask turtles [
    let oy ycor
    let ondeayakta count other turtles with [color = yellow and ycor > oy]
    let goru ondeayakta

    if yanabakma? = true [
      let ayniayakta count other turtles with [color = yellow and ycor = oy]
      set goru goru + ayniayakta
    ]
    if arkaya = 1 [
      let arkaayakta count other turtles with [color = yellow and ycor < oy]
      set goru goru + arkaayakta
    ]

    ;;show ayakta
    if goru >= kack [
      set color yellow
      set ayakta? true
    ]
  ]
  set kalkanlar count turtles with [color = yellow]
  set oran-ayakta kalkanlar / nufus
end 

to spawn-by-row
  ; get the intervals
  let h-int world-width / number
  let v-int world-height / sira
  set nufus number * sira

  ; Get a range of horizontal and vertical coordinates, starting at half
  ; of the interval value from the minimum x coordinate
  let h-vals ( range ( min-pxcor + h-int / 2 ) max-pxcor h-int )
  let v-vals ( range ( min-pycor + v-int / 2 ) max-pycor v-int )

  ; Create an empty list to build into
  let possible-coords []

  ; For each possible vertical value, map all horizontal values in order and
  ; combine these into an ordered list starting at the lowest px and py coords

  foreach v-vals [
    v ->
    set possible-coords ( sentence possible-coords map [ i -> (list i v) ] h-vals )
  ]

  ; Use the number of readers to sublist the possible coordinates, and
  ; create a turtle at each of the coordinate combinations left.

  foreach possible-coords [
    coords ->
    create-turtles 1 [
      setxy item 0 coords item 1 coords
      set SIZE 2
      set shape "square"
      set color green
      set kack random nufus + 1
      let tef random 100
      if tef < arkayabak [set arkaya 1 ]
    ]
  ]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Tevfik Uyar over 4 years ago Display update. Download this version
Tevfik Uyar over 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Standing Ovation.png preview Preview for 'Standing Ovation' over 4 years ago, by Tevfik Uyar Download

This model does not have any ancestors.

This model does not have any descendants.