Skip to content

Commit 9775eea

Browse files
Slight tweak to rows/columns extraction
1 parent 7b877fe commit 9775eea

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

shared/src/games/tic-tac-toe.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ export class TicTacToeGame implements Game<TicTacToeGameState, TicTacToeMove> {
7878
throw new Error('Invalid move');
7979
}
8080

81+
const row = Number(move.row);
82+
const col = Number(move.col);
83+
8184
const newBoard = gameState.board.map(row => [...row]);
82-
newBoard[move.row][move.col] = gameState.playerSymbols[playerId];
85+
newBoard[row][col] = gameState.playerSymbols[playerId];
8386

8487
// Switch to next player
8588
const nextPlayerId = gameState.players.find(p => p.id !== playerId)?.id || 'player1';

0 commit comments

Comments
 (0)