This page was automatically generated by NetLogo 5.0.1.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.


In order for this to work, this file, your model file (vie.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)

powered by NetLogo

view/download model file: vie.nlogo

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)

CODE

;; Deux variables globales pour la couleur du fond et d'une cellule en vie
;;globals[couleurFond couleurVie]

;; Informations contenues dans chaque patches
patches-own [
  vivante?         ;; cellule en vie
  nbVoisins        ;; nbre de cellule voisine en vie
]

;; Initialisation de la grille
;; Chaque patch à Densité% de chance de contenir une cellule en vie
to setup
  ca
  set couleurFond black
  set couleurVie blue
  ask patches [
    ifelse random-float 100 < Densité
    [naissanceCellule]
    [mortCellule]
  ]
  reset-ticks       ;; Initialise l'horloge initialise les courbes
end

to setup-vide
  clear-all
  ask patches [mortCellule]
  reset-ticks
end


to naissanceCellule
  set vivante? true
  set pcolor couleurVie
end

to mortCellule
  set vivante? false
  set pcolor couleurFond
end

;; Application des régles
to go
  ;; On demande à chaque patches le nombre de voisins en vie
  ask patches [
    set nbVoisins count neighbors with [vivante?]
  ]
  ask patches [
    ifelse nbVoisins = 3
    [ naissanceCellule ]
    [if nbVoisins != 2
      [ mortCellule ]]
  ]
  tick               ;; On avance l'horloge maj des courbes
end



to ajouteCellules
  if mouse-down? [
    ask patch mouse-xcor mouse-ycor [naissanceCellule]
    display
    ]
end

to tueCellules
  if mouse-down? [
    ask patch mouse-xcor mouse-ycor [mortCellule]
    display
    ]
end