mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
Merge branch 'master' of https://github.com/sachy/brmlife
This commit is contained in:
commit
5435014c1d
1 changed files with 45 additions and 7 deletions
52
viewer.nlogo
52
viewer.nlogo
|
@ -1,20 +1,21 @@
|
||||||
globals [w h]
|
globals [w h symbol herbs]
|
||||||
to init
|
to init
|
||||||
clear-all;
|
clear-all;
|
||||||
file-close-all;
|
file-close-all;
|
||||||
set w 0;
|
set w 0;
|
||||||
set h 0;
|
set h 0;
|
||||||
|
set herbs 0;
|
||||||
|
set symbol "";
|
||||||
file-open "rawio_cfg";
|
file-open "rawio_cfg";
|
||||||
resize-world 0 ((read-from-string file-read-line) - 1) (1 - (read-from-string file-read-line)) 0;
|
resize-world 0 ((read-from-string file-read-line) - 1) (1 - (read-from-string file-read-line)) 0;
|
||||||
file-close-all
|
file-close-all
|
||||||
end
|
end
|
||||||
|
|
||||||
to go
|
to go
|
||||||
file-open "rawio_map";
|
file-open "rawio_map";
|
||||||
while [file-at-end? = false]
|
while [file-at-end? = false]
|
||||||
[
|
[
|
||||||
let symbol file-read-characters 1;
|
set symbol file-read-characters 1;
|
||||||
if (symbol = "\n" or symbol = "\r") and file-at-end? = false
|
if (symbol = "\n" or symbol = "\r") and file-at-end? = false
|
||||||
[
|
[
|
||||||
set symbol file-read-characters 1;
|
set symbol file-read-characters 1;
|
||||||
|
@ -24,20 +25,29 @@ to go
|
||||||
if symbol = "x"
|
if symbol = "x"
|
||||||
[
|
[
|
||||||
ask patch w h [set pcolor green ];
|
ask patch w h [set pcolor green ];
|
||||||
|
set herbs herbs + 1
|
||||||
]
|
]
|
||||||
if symbol = "."
|
if symbol = "."
|
||||||
[
|
[
|
||||||
ask patch w h [set pcolor black ]
|
ask patch w h [set pcolor black ];
|
||||||
|
]
|
||||||
|
if member? symbol ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"]
|
||||||
|
[
|
||||||
|
ask patch w h [set pcolor red ];
|
||||||
]
|
]
|
||||||
set w w + 1;
|
set w w + 1;
|
||||||
]
|
]
|
||||||
file-close-all;
|
file-close-all;
|
||||||
|
|
||||||
|
set-current-plot "herbs";
|
||||||
|
set-current-plot-pen "herbs";
|
||||||
|
plot count patches with [pcolor = green];
|
||||||
|
|
||||||
tick;
|
tick;
|
||||||
set w 0;
|
set w 0;
|
||||||
set h 0;
|
set h 0;
|
||||||
wait 1;
|
wait 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
@#$#@#$#@
|
@#$#@#$#@
|
||||||
GRAPHICS-WINDOW
|
GRAPHICS-WINDOW
|
||||||
111
|
111
|
||||||
|
@ -97,6 +107,34 @@ NIL
|
||||||
NIL
|
NIL
|
||||||
NIL
|
NIL
|
||||||
|
|
||||||
|
PLOT
|
||||||
|
91
|
||||||
|
332
|
||||||
|
291
|
||||||
|
482
|
||||||
|
herbs
|
||||||
|
NIL
|
||||||
|
NIL
|
||||||
|
0.0
|
||||||
|
10.0
|
||||||
|
0.0
|
||||||
|
10.0
|
||||||
|
true
|
||||||
|
false
|
||||||
|
PENS
|
||||||
|
"herbs" 1.0 0 -16777216 true
|
||||||
|
|
||||||
|
MONITOR
|
||||||
|
17
|
||||||
|
411
|
||||||
|
74
|
||||||
|
456
|
||||||
|
herbs
|
||||||
|
count patches with [pcolor = green]
|
||||||
|
17
|
||||||
|
1
|
||||||
|
11
|
||||||
|
|
||||||
@#$#@#$#@
|
@#$#@#$#@
|
||||||
WHAT IS IT?
|
WHAT IS IT?
|
||||||
-----------
|
-----------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue