--define(CHAR_DEAD, 32). % Space
--define(CHAR_ALIVE, 111). % o
--define(CHAR_BAR, 45). % -
+-define(CHAR_DEAD, 32). % " "
+-define(CHAR_ALIVE, 111). % "o"
+-define(CHAR_BAR, 45). % "-"
%% ============================================================================
handle_call(_Msg, _From, State) -> {reply, ok, State}.
%% ============================================================================
handle_call(_Msg, _From, State) -> {reply, ok, State}.
code_change(_Old, State, _Other) -> {ok, State}.
terminate(_Reason, State) -> {ok, State}.
code_change(_Old, State, _Other) -> {ok, State}.
terminate(_Reason, State) -> {ok, State}.
handle_cast({report_state, {CellID, GenID, CellState}},
#state{x=X
,y=Y
handle_cast({report_state, {CellID, GenID, CellState}},
#state{x=X
,y=Y
ok = io:format(
"X: ~b Y: ~b CELLS: ~b DEAD: ~b ALIVE: ~b GENERATION: ~b~n",
[X, Y, NumCells, NewNDead, NewNAlive, GenID]
),
ok = do_print_bar(X),
ok = do_print_state_chars(X, StateChars),
ok = io:format(
"X: ~b Y: ~b CELLS: ~b DEAD: ~b ALIVE: ~b GENERATION: ~b~n",
[X, Y, NumCells, NewNDead, NewNAlive, GenID]
),
ok = do_print_bar(X),
ok = do_print_state_chars(X, StateChars),
ok = schedule_next_gen(),
{noreply, NewState#state{state_pairs=[]}};
ok = schedule_next_gen(),
{noreply, NewState#state{state_pairs=[]}};