aboutsummaryrefslogtreecommitdiff
path: root/tictactoe-2/apps/ttt
diff options
context:
space:
mode:
Diffstat (limited to 'tictactoe-2/apps/ttt')
-rw-r--r--tictactoe-2/apps/ttt/src/ttt.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/tictactoe-2/apps/ttt/src/ttt.erl b/tictactoe-2/apps/ttt/src/ttt.erl
index a9fc4d1..f030f03 100644
--- a/tictactoe-2/apps/ttt/src/ttt.erl
+++ b/tictactoe-2/apps/ttt/src/ttt.erl
@@ -45,7 +45,8 @@ move(Board, Move, Row, Col) ->
Updated = lists:sublist(Board, I) ++ [Move] ++ lists:nthtail(I + 1, Board),
{ok, Updated}.
+-spec format(board()) -> io_lib:chars().
format(Board) when length(Board) == 9 ->
B = lists:map(fun(C) -> case C of 'E' -> ' '; _ -> C end end, Board),
- io:format("+---+~n|~s~s~s|~n|~s~s~s|~n|~s~s~s|~n+---+~n", B);
+ io_lib:format("+---+~n|~s~s~s|~n|~s~s~s|~n|~s~s~s|~n+---+~n", B);
format(_) -> "bad board".