a generalized tic-tac-toe