Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
-module(ca).
|
||||
-compile(export_all).
|
||||
|
||||
run(N,G) ->
|
||||
run(N,G,0).
|
||||
|
||||
run(GN,G,GN) ->
|
||||
io:fwrite("~B: ",[GN]),
|
||||
print(G);
|
||||
run(N,G,GN) ->
|
||||
io:fwrite("~B: ",[GN]),
|
||||
print(G),
|
||||
run(N,next(G),GN+1).
|
||||
|
||||
print([]) ->
|
||||
io:fwrite("~n");
|
||||
print([0|T]) ->
|
||||
io:fwrite("_"),
|
||||
print(T);
|
||||
print([1|T]) ->
|
||||
io:fwrite("#"),
|
||||
print(T).
|
||||
|
||||
next([]) ->
|
||||
[];
|
||||
next([_]) ->
|
||||
[0];
|
||||
next([H,1|_]=G) ->
|
||||
next(G,[H]);
|
||||
next([_|_]=G) ->
|
||||
next(G,[0]).
|
||||
|
||||
next([],Acc) ->
|
||||
lists:reverse(Acc);
|
||||
next([0,_],Acc) ->
|
||||
next([],[0|Acc]);
|
||||
next([1,X],Acc) ->
|
||||
next([],[X|Acc]);
|
||||
next([0,X,0|T],Acc) ->
|
||||
next([X,0|T],[0|Acc]);
|
||||
next([1,X,0|T],Acc) ->
|
||||
next([X,0|T],[X|Acc]);
|
||||
next([0,X,1|T],Acc) ->
|
||||
next([X,1|T],[X|Acc]);
|
||||
next([1,0,1|T],Acc) ->
|
||||
next([0,1|T],[1|Acc]);
|
||||
next([1,1,1|T],Acc) ->
|
||||
next([1,1|T],[0|Acc]).
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
44> ca:run(9,[0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0]).
|
||||
0: __###_##_#_#_#_#__#___
|
||||
1: __#_#####_#_#_#_______
|
||||
2: ___##___##_#_#________
|
||||
3: ___##___###_#_________
|
||||
4: ___##___#_##__________
|
||||
5: ___##____###__________
|
||||
6: ___##____#_#__________
|
||||
7: ___##_____#___________
|
||||
8: ___##_________________
|
||||
9: ___##_________________
|
||||
Loading…
Add table
Add a link
Reference in a new issue