From: Siraaj Khandkar Date: Mon, 3 Sep 2012 18:48:52 +0000 (-0400) Subject: Light refactoring. X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=86e687a7e94874ace3b0e4be3e87e1f99a725215;p=cellular-automata.git Light refactoring. --- diff --git a/forest-fire/001/src/forest_fire.ml b/forest-fire/001/src/forest_fire.ml index 66285a9..3cee973 100644 --- 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