       rand_unoccupied_space(snakes, food)
     end
   end
-
-  def draw(%{"board" => board, "food" => food, "snakes" => snakes} = state) do
-    coords = Enum.flat_map snakes, & &1["coords"]
-
-    rows = length board
-    max = rows
-    min = -1
-    range = min..max
-
-    for y <- range do
-      for x <- range do
-        case {x, y} do
-          {-1, -1} ->
-            " ╔"
-
-          {^max, ^max} ->
-            "╝ "
-
-          {^max, -1} ->
-            "╗ "
-
-          {-1, ^max} ->
-            " ╚"
-
-          {-1, _} ->
-            " ║"
-
-          {^max, _} ->
-            "║ "
-
-          {_, y} when y in [min, max] ->
-            "══"
-
-          {x, y} ->
-            board
-            |> Enum.at(x)
-            |> Enum.at(y)
-            |> get_in(["state"])
-            |> case do
-              "head" ->
-                "{}"
-              "body" ->
-                "[]"
-              "food" ->
-                "()"
-              "empty" ->
-                "  "
-            end
-        end
-      end
-    end
-  end
-
-  def print(%{"board" => board, "food" => food, "snakes" => snakes} = state) do
-    coords = Enum.flat_map snakes, & &1["coords"]
-
-    rows = length board
-    max = rows
-    min = -1
-    range = min..max
-
-    # clear
-    IO.write("\n")
-    if @clear, do: IO.write("\ec")
-
-    for y <- range, x <- range do
-      case {x, y} do
-        {-1, -1} ->
-          " ╔"
-
-        {^max, ^max} ->
-          "╝ "
-
-        {^max, -1} ->
-          "╗ "
-
-        {-1, ^max} ->
-          " ╚"
-
-        {-1, _} ->
-          " ║"
-
-        {^max, _} ->
-          "║ "
-
-        {_, y} when y in [min, max] ->
-          "══"
-
-        {x, y} ->
-          board
-          |> Enum.at(x)
-          |> Enum.at(y)
-          |> get_in(["state"])
-          |> case do
-            "head" ->
-              "#{IO.ANSI.blue}[]#{IO.ANSI.reset}"
-            "body" ->
-              "#{IO.ANSI.green}[]#{IO.ANSI.reset}"
-            "food" ->
-              "#{IO.ANSI.red}()#{IO.ANSI.reset}"
-            "empty" ->
-              "  "
-          end
-
-      end |> IO.write
-
-      if x == max do
-        IO.write "\n"
-      end
-    end
-
-    IO.puts "Turn: #{state["turn"]}"
-
-    for snake <- state["snakes"] do
-      IO.puts "#{snake["name"]}: #{length snake["coords"]}"
-    end
-
-    state
-  end
 end

        [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

  @turn_delay 100
  @clear false

  def tick(%{"snakes" => []} = state, previous) do
    :ok
  end

  def tick(state), do: tick(state, state)

  def init_food state, max do
    Enum.reduce 1..max, state, fn _, state ->
