tic-tac-toe without side effects or loops