JavaScript tic-tac-toe variant