logic of mathematician's tic-tac-toe now works, but with much redundant code