Skip to content

Instantly share code, notes, and snippets.

@jakenotjacob
Created December 19, 2015 07:53
Show Gist options
  • Save jakenotjacob/93accad7e3ea14ceb8c5 to your computer and use it in GitHub Desktop.
Save jakenotjacob/93accad7e3ea14ceb8c5 to your computer and use it in GitHub Desktop.
Beginning code of Tetris in Elixir.
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