%% ============================================================================
handle_call(_Msg, _From, State) -> {reply, ok, State}.
-handle_info(_Msg, State) -> {noreply, State}.
code_change(_Old, State, _Other) -> {ok, State}.
terminate(_Reason, State) -> {ok, State}.
{ok, State}.
-handle_cast(next_gen,
+handle_info(next_gen,
#state{cells=Cells
,num_cells=NumCells
,state_pairs=[]
},
{noreply, NewState};
+handle_info(_Msg, State) ->
+ {noreply, State}.
+
+
handle_cast({report_state, {CellID, GenID, CellState}},
#state{x=X
,y=Y
),
ok = do_print_bar(X),
ok = do_print_state_chars(X, StateChars),
- ok = timer:sleep(?INTERVAL),
+
ok = schedule_next_gen(),
{noreply, NewState#state{state_pairs=[]}};
schedule_next_gen() ->
- ok = gen_server:cast(?MODULE, next_gen).
+ erlang:send_after(?INTERVAL, self(), next_gen),
+ ok.
state_to_char(0) -> ?CHAR_DEAD;