Tic tac toe validator in Erlang