···9292 IO.puts ""
9393 for x <- 0..2 do
9494 row = for c <- Board.row(board, x) do
9595- if c do c else '.' end
9595+ if c do c else "." end
9696 end
9797 IO.puts(Enum.join row, " ")
9898 end
+18-3
lib/tit_tac_toe.ex
···1515 :world
16161717 """
1818- def run(_) do
1919- Logger.configure [level: :info]
2020- game = [o: Client.Random, x: Client.Random] |> Game.new |> Game.play
1818+ def run(args) do
1919+ Logger.configure [level: :debug]
2020+2121+2222+ player_map = %{
2323+ "rand" => Client.Random,
2424+ "term" => Client.Terminal,
2525+ "udp" => Client.UDP
2626+ }
2727+2828+ args = case args do
2929+ [] -> ["rand", "rand"]
3030+ args -> args
3131+ end
3232+3333+ [px, po] = Enum.map(args, fn name -> Map.fetch!(player_map, name) end)
3434+3535+ game = [x: px, o: po] |> Game.new |> Game.play
2136 case game do
2237 {:ok, game} -> Game.State.inspect(game)
2338 {:error, error} -> IO.inspect error