Created
December 19, 2015 07:53
-
-
Save jakenotjacob/93accad7e3ea14ceb8c5 to your computer and use it in GitHub Desktop.
Beginning code of Tetris in Elixir.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tetris.Board do | |
def start_link do | |
Agent.start_link(fn -> | |
List.flatten(Enum.map(?a..?j, fn x -> | |
Enum.map(?0..?9, fn y -> | |
{String.to_atom(<< x, y >>), nil} | |
end) | |
end)) | |
end, name: :board) | |
end | |
def get do | |
Agent.get(:board, fn list -> list end) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment