home
/
code
/
cellular-automata.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start-up wrapper script for 003.
[cellular-automata.git]
/
001
/
src
/
life_god.erl
diff --git
a/001/src/life_god.erl
b/001/src/life_god.erl
index
d9f6237
..
ea3b236
100644
(file)
--- a/
001/src/life_god.erl
+++ b/
001/src/life_god.erl
@@
-3,7
+3,7
@@
%% API
%% API
--export([start_link/
2
]).
+-export([start_link/
3
]).
%% Callbacks
-export([init/1]).
%% Callbacks
-export([init/1]).
@@
-17,20
+17,24
@@
%% API
%% ============================================================================
%% API
%% ============================================================================
-start_link(X, CellData) ->
- supervisor:start_link({local, ?MODULE}, ?MODULE, [X, CellData]).
+start_link(X,
Y,
CellData) ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, [X,
Y,
CellData]).
%% ============================================================================
%% Callbacks
%% ============================================================================
%% ============================================================================
%% Callbacks
%% ============================================================================
-init([X, CellData]) ->
+init([X,
Y,
CellData]) ->
CellNames = [Name || {_, Name, _} <- CellData],
CellNames = [Name || {_, Name, _} <- CellData],
- RestartStrategy = {one_for_one, 5, 10},
+ RestartStrategy = {one_for_one, 1000000, 1},
+
+ Observer = ?CHILD(worker, life_observer, [X, Y]),
Cells = [spec_cell(Datum) || Datum <- CellData],
Cells = [spec_cell(Datum) || Datum <- CellData],
- Time = ?CHILD(worker, life_time, [X, CellNames]),
- Children = Cells ++ [Time],
+ Time = ?CHILD(worker, life_time, [X, Y, CellNames]),
+
+ Children = [Observer | Cells ++ [Time]],
+
{ok, {RestartStrategy, Children}}.
{ok, {RestartStrategy, Children}}.
@@
-39,9
+43,3
@@
spec_cell({_, Name, _}=Datum) ->
F = start_link,
A = [Datum],
{Name, {M, F, A}, permanent, 5000, worker, [M]}.
F = start_link,
A = [Datum],
{Name, {M, F, A}, permanent, 5000, worker, [M]}.
-
- %{ID, {ID, start_link, Args}, permanent, 5000, Type, [ID]}.
-
-
-
-
This page took
0.018507 seconds
and
4
git commands to generate.