;; SUMMARY ;;;; A tiny version of Conway's Life. Click it to stop it. ;; COPYRIGHT & LICENSE ;;;; Copyright (C) 2005 James P. Steiner ;;;; Some Rights Reserved. ;;;; Creative Commons Attribution-NonCommercial-ShareAlike License v. 2.0. ;;;; Visit http://creativecommons.org/licenses/by-nc-sa/2.0/ for more information. ;; APPLET DIMENSIONS (width x height) ;;;; 149 x 161 ;; globals [ ;; mouse-effects variables click? run-mode ] patches-own [ ;; model variables alive? new-status ] to startup setup loop [ go ] end to setup ca set run-mode 1 set click? false ;; model setup tasks setup-life display end to go no-display go-mouse-effects if run-mode > 0 [ go-life every (30 * run-mode) [ randomize-life ] ] display wait 1 / 15 end to go-mouse-effects ifelse mouse-down? [ if click? != true [ set click? true ] ] [ if click? = true [ set run-mode run-mode + 1 if run-mode > 1 [ set run-mode 0 ] set click? false ] ] end to setup-life randomize-life end to go-life ask patches [ let c count neighbors with [ alive? = 1 ] ifelse alive? = 0 [ if c = 3 [ set new-status 1 ] ] [ if c < 2 or c > 3 [ set new-status 0 ] ] ] ask patches [ ifelse new-status = 0 [ set pcolor black ] [ ifelse new-status = alive? [ set pcolor pcolor - 10 ] [ set pcolor gray ] ] set alive? new-status ] end to randomize-life ask patches [ set alive? ifelse-value (random 100 <= 50) [ 1 ] [ 0 ] ] end @#$#@#$#@ GRAPHICS-WINDOW 9 10 141 163 30 30 2.0 1 10 1 1 1 0 0 0 1 CC-WINDOW 5 177 150 272 Command Center 0 @#$#@#$#@ INFORMATION ----------- COPYRIGHT --------- Tiny-life Copyright (C) 2005 James P. Steiner @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 3.0 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@