home
/
code
/
cellular-automata.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8cf59f0
)
Light refactoring.
author
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 3 Sep 2012 18:48:52 +0000
(14:48 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 3 Sep 2012 18:48:52 +0000
(14:48 -0400)
forest-fire/001/src/forest_fire.ml
patch
|
blob
|
blame
|
history
diff --git
a/forest-fire/001/src/forest_fire.ml
b/forest-fire/001/src/forest_fire.ml
index
66285a9
..
3cee973
100644
(file)
--- a/
forest-fire/001/src/forest_fire.ml
+++ b/
forest-fire/001/src/forest_fire.ml
@@
-138,6
+138,8
@@
let new_state = function
let print_forest forest =
+ term_reset ();
+
Array.iter
(
fun row ->
@@
-175,10
+177,12
@@
let next_generation forest (width, height) prob =
let rec burn forest size prob interval =
- term_reset ();
print_forest forest;
+
if interval > 0.0 then minisleep interval;
- burn (next_generation forest size prob) size prob interval
+
+ let next_forest = next_generation forest size prob in
+ burn next_forest size prob interval
let main argv =
@@
-188,6
+192,7
@@
let main argv =
let forest = init_forest opts.size opts.prob in
term_clear ();
+
burn forest opts.size opts.prob opts.interval
This page took
0.02623 seconds
and
4
git commands to generate.