   @turn_delay 100
   @clear false
 
-  def start do
-    board = for x <- 0..@size, do: for y <- 0..@size, do: %{}
-
-    snakes = [
-      Snake.new(%{"name" => "Snek"}, @size, @size),
-      #Snake.new(%{"name" => "Test"}, @size, @size),
-    ]
-
-    state = %{
-      "game_id" => "",
-      "turn" => 0,
-      "board" => board,
-      "snakes" => snakes,
-      "food" => [],
-      rows: @size,
-      cols: @size,
-    }
-
-    state
-    |> init_food(@max_food)
-    |> update_board
-    |> tick
-  end
-
   def tick(%{"snakes" => []} = state, previous) do
-    print previous
-    IO.puts "Game Over"
     :ok
   end
 
   def tick(state), do: tick(state, state)
-
-  def tick(state, previous) do
-    if rem(state["turn"], @draw_frames) == 0 do
-      print state
-      Process.sleep @turn_delay
-    end
-
-    state
-    |> update_in(["turn"], & &1 + 1)
-    |> make_move
-    |> step
-    |> add_new_food
-    |> update_board
-    |> tick(state)
-  end
 
   def init_food state, max do
     Enum.reduce 1..max, state, fn _, state ->

        [rand_unoccupied_space(state) | food]
      end
    end
  end

  def make_move state do
    moves = for snake <- state["snakes"] do
      name = snake["name"]
      direction = Snek.Agent.move(state, name)
      {name, direction}
    end

    moves = Enum.into moves, %{}

    apply_moves state, moves
  end

  def add_new_food(state) do

      rand_unoccupied_space(snakes, food)
    end
  end
end
