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:
704cefa
)
Ensuring sleep value is at least zero.
author
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 9 Aug 2012 18:26:39 +0000
(14:26 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 9 Aug 2012 18:26:39 +0000
(14:26 -0400)
003/src/life.erl
patch
|
blob
|
blame
|
history
diff --git
a/003/src/life.erl
b/003/src/life.erl
index
f4b1fe5
..
605fa95
100644
(file)
--- a/
003/src/life.erl
+++ b/
003/src/life.erl
@@
-74,12
+74,16
@@
life_loop(
},
NewTimeMil = NewTime / 1000,
- NextGenDelay =
round(?GEN_INTERVAL - NewTimeMil
),
+ NextGenDelay =
at_least_zero(round(?GEN_INTERVAL - NewTimeMil)
),
timer:sleep(NextGenDelay),
life_loop(NewState).
+at_least_zero(Integer) when Integer >= 0 -> Integer;
+at_least_zero(_) -> 0.
+
+
do_print_screen(Board, Bar, X, Y, N, GenCount, Time, PrintTime) ->
ok = do_print_status(Bar, X, Y, N, GenCount, Time, PrintTime),
ok = do_print_board(Board).
This page took
0.019874 seconds
and
4
git commands to generate.