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 142 times • Downloaded 19 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.)


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

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 almost 2 years ago by Rodrigo Reis.

Attached files

File Type Description Last updated
Lion.png preview Preview for 'Lion' almost 2 years ago, by Rodrigo Reis Download

This model does not have any ancestors.

This model does not have any descendants.