📄 ---igra_zivljenje.nlogo
字号:
patches-own [ living? ;; indicates if the cell is living live-neighbors ;; counts how many neighboring cells are alive]to nastavi-prazno ask patches [ cell-death ]endto nastavi-nakljucno ask patches [ ifelse random-float 1.0 < zacetna-gostota [ cell-birth ] [ cell-death ] ]endto cell-birth set living? true set pcolor barva_celicendto cell-death set living? false set pcolor barva_ozadjaendto go if mouse-down? [ stop ] ;; wait for user to stop drawing ask patches [ set live-neighbors count neighbors with [living?] ] ;; Starting a new "ask patches" here ensures that all the patches ;; finish executing the first ask before any of them start executing ;; the second ask. This keeps all the patches in sync with each other, ;; so the births and deaths at each generation all happen in lockstep. ask patches [ ifelse live-neighbors = 3 [ cell-birth ] [ if live-neighbors != 2 [ cell-death ] ] ]endto dodaj-celice if mouse-down? [ ask patch-at mouse-xcor mouse-ycor [ cell-birth ] ]endto odstrani-celice if mouse-down? [ ask patch-at mouse-xcor mouse-ycor [ cell-death ] ]end; *** NetLogo Model Copyright Notice ***;; This model was created as part of the project: CONNECTED MATHEMATICS:; MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL; MODELS (OBPML). The project gratefully acknowledges the support of the; National Science Foundation (Applications of Advanced Technologies; Program) -- grant numbers RED #9552950 and REC #9632612.;; Copyright 1998 by Uri Wilensky. All rights reserved.;; Permission to use, modify or redistribute this model is hereby granted,; provided that both of the following requirements are followed:; a) this copyright notice is included.; b) this model will not be redistributed for profit without permission; from Uri Wilensky.; Contact Uri Wilensky for appropriate licenses for redistribution for; profit.;; This model was converted to NetLogo as part of the project:; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN; CLASSROOMS. The project gratefully acknowledges the support of the; National Science Foundation (REPP program) -- grant number REC #9814682.; Converted from StarLogoT to NetLogo, 2001. Updated 2002.;; To refer to this model in academic publications, please use:; Wilensky, U. (1998). NetLogo Life model.; http://ccl.northwestern.edu/netlogo/models/Life.; Center for Connected Learning and Computer-Based Modeling,; Northwestern University, Evanston, IL.;; In other publications, please use:; Copyright 1998 by Uri Wilensky. All rights reserved. See; http://ccl.northwestern.edu/netlogo/models/Life; for terms of use.;; *** End of NetLogo Model Copyright Notice ***@#$#@#$#@GRAPHICS-WINDOW3011183638861404.27110111CC-WINDOW2906921272858Command CenterSLIDER71016343zacetna-gostotazacetna-gostota0.01.00.30.011NILBUTTON1475227585NILnastavi-nakljucnoNIL1TOBSERVERTBUTTON10223118256za瀍ni-enkratgoNIL1TOBSERVERTBUTTON149226283259za瀍ni-naskon鑞ogoT1TOBSERVERTSLIDER147283284316barva_celicbarva_celic0.0139.0112.01.01NILSLIDER146337283370barva_ozadjabarva_ozadja0.0139.079.01.01NILBUTTON9338134371ponovno obarvajifelse living?\n [ set pcolor barva_celic ]\n [ set pcolor barva_ozadja ]NIL1TPATCHTMONITOR10273114322trenutna gostotacount patches with\n [living?]\n/ count patches * 10021BUTTON85112484NILnastavi-praznoNIL1TOBSERVERTTEXTBOX136101287206Ko je aktiven (pritisnjen) eden od teh gumbov,lahko dodaja
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -