Organized reused functions into lib module.
[cellular-automata.git] / 001 / src / life_time.erl
index 22d3300..c3b7a45 100644 (file)
@@ -86,7 +86,7 @@ handle_cast(next_gen,
           }=State) ->
 
     NewGenID = GenID + 1,
-    ok = cast_all(Cells, {next_gen, NewGenID}),
+    ok = life_lib:cast_one2all(Cells, {next_gen, NewGenID}),
     NewState = State#state{replies_pending=NumCells
                           ,gen_id=NewGenID
                           ,num_dead=0
@@ -151,12 +151,6 @@ schedule_next_gen() ->
     ok = gen_server:cast(?MODULE, next_gen).
 
 
-cast_all([], _) -> ok;
-cast_all([Server | Servers], Msg) ->
-    ok = gen_server:cast(Server, Msg),
-    cast_all(Servers, Msg).
-
-
 state_to_char(0) -> ?CHAR_DEAD;
 state_to_char(1) -> ?CHAR_ALIVE.
 
This page took 0.022606 seconds and 4 git commands to generate.