Lion

Lion preview image

1 collaborator

Default-person Rodrigo Reis (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 20 times • Downloaded 2 times • Run 0 times
Download the 'Lion' 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 [lions lion]
breed [hyenas hyena]

lions-own [ energy]
hyenas-own [ energy]

;alimentos
;celulas castanhas(pequeno porte) 0% a 20%
;celulas vermelhas(grande porte)  0% a 10%
;Apos alimento de grande porte ser comido vira pequeno porte
;Quando pequeno porte for comido vira celula vazia(celula preta)
;Energia ingestida pelo alimentos pode configurar entre 1 e 50

;células azuis, aleatoriamente posicionadas aleatoriamente entre 0 e 5.

; Os alimentos de pequeno porte devem reaparecer aleatoriamente
;no ambiente de tal forma a que os níveis configurados se mantenham semelhantes ao longo
;da simulação.

to setup
  spawn-food
  spawn-animals
end 

to go
 regenerate-food
end 

to spawn-animals
  create-lions start-lions-count [
    set color orange ; You can set their color or other properties
    set energy 100   ; Set initial energy level
    setxy random-xcor random-ycor ; Set initial position randomly
    set shape "lion" ; Assign the lion sprite
    set size 1.7
  ]

  create-hyenas start-hyenas-count [
    set color yellow ; You can set their color or other properties
    set energy 80  ; Set initial energy level
    setxy random-xcor random-ycor ; Set initial position randomly
    set shape "wolf" ; Assign the hyena sprite
    set size 1.5
  ]
end 

to spawn-food
  clear-all
  let max-small-food count(patches) * percentage-small-food / 100
  let max-big-food count(patches) * percentage-big-food / 100


  ;seleciona aleatoriamente no max-patches da patches
  ask n-of max-small-food patches with [pcolor = black] [set pcolor brown]
  ask n-of max-big-food patches with [pcolor = black] [set pcolor red]
  ask n-of blue-cell-count patches with [pcolor = black] [set pcolor blue]
end 

to regenerate-food
  let max-small-food count(patches) * percentage-small-food / 100
  let max-big-food count(patches) * percentage-big-food / 100
  let empty-patches patches with [pcolor = black] ; guarda todas patches com cor preta

  ;Regenerar alimento de pequeno porte
  let current-small-food count patches with [pcolor = brown]
  if(current-small-food < max-small-food)
  [
    let num-to-regen max-small-food - current-small-food
    ask n-of num-to-regen empty-patches [set pcolor brown]
  ]


  let current-big-food count patches with [pcolor = red]
  ; Regenerar alimento de grande porte
  if(current-big-food < max-big-food)
  [
    let num-to-regen max-big-food - current-big-food
    ask n-of num-to-regen empty-patches [set pcolor red]
  ]
end 

There is only one version of this model, created 7 months ago by Rodrigo Reis.

Attached files

File Type Description Last updated
Lion.png preview Preview for 'Lion' 7 months ago, by Rodrigo Reis Download

This model does not have any ancestors.

This model does not have any descendants.