Skip to content

Instantly share code, notes, and snippets.

@sntran
Forked from jszmajda/Readme.md
Last active December 15, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sntran/5180107 to your computer and use it in GitHub Desktop.
Save sntran/5180107 to your computer and use it in GitHub Desktop.
Conway's Game of Life in Erlang Conway's Game of Life in Erlang, in 2 hours, with 0 Erlang experience, in 22 lines of code.
io:format("Hello").

sadsadasd

sadasd

<%= files["Flick.png"] %>

  • @sntran
  • @sdfippinger

<%= files["gol.erl"] %>

<%= files["another.erl"] %>

Nothing is impossible

/sntran/5180107/files/Flick.png
-module(gol).
-compile(export_all).
lives(2,true) ->
false;
lives(3,_) ->
true;
lives(_,_) ->
false.
intersect_lists(A,B) ->
sets:to_list(sets:intersection(sets:from_list(A), sets:from_list(B))).
neighbors(Xin,Yin, World) ->
Ns = [{X+Xin, Y+Yin, true} || X <- [-1,0,1], Y <- [-1,0,1] ],
length(intersect_lists(World, Ns))
- length([ true || {A,B,true} <- World, A == Xin, B == Yin ]).
transmute_world(World) ->
[ {X, Y, gol:lives(gol:neighbors(X,Y, World), Alive)} || {X,Y,Alive} <- World ].
@sntran
Copy link
Author

sntran commented Sep 22, 2013

This is just a test gist.

  • heading inside lsit?

Yep or not?

  • Another list

@sntran
Copy link
Author

sntran commented Oct 6, 2013

Another comment

Heading 2

Some blockquote
Hello
Then

SImple paragraph

io:format("cool~n").

@sntran
Copy link
Author

sntran commented Oct 19, 2013

Heading

@sntran
Copy link
Author

sntran commented Oct 20, 2013

Another comment!

  • One
  • Two
  • Three

@sntran
Copy link
Author

sntran commented Oct 20, 2013

Hello

@sntran
Copy link
Author

sntran commented Oct 20, 2013

World

@sdfippinger
Copy link

Test

@sdfippinger
Copy link

test

@sdfippinger
Copy link

TEST

@sdfippinger
Copy link

Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment