A generalized tic-tac-toe