Command line tic-tac-toe with arbitrary rules