Skip to content

Commit 741eecd

Browse files
authored
Merge pull request #68 from boardgamers/randomboolean-patch-1
bugfix other typos in tictactoe.md ts examples
2 parents 4e5e748 + 9abfbb9 commit 741eecd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/docs/docs/guide/tictactoe.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ function winner(board: Board): Player | undefined {
100100
Then we add that info in the `move` function:
101101

102102
```ts
103-
export function move(state: GameState, move: Coord, player: Player) {
103+
export function move(state: GameState, coord: Coord, player: Player) {
104104
state.board[coord.x][coord.y] = player;
105-
state.moves.push({ player, coord: move });
105+
state.moves.push({ player, coord });
106106
// Either it stays undefined or is set to the winner
107107
state.winner = winner(state.board);
108108

@@ -165,7 +165,7 @@ export function currentPlayer(state: GameState): Player {
165165
return 0;
166166
}
167167

168-
return opponent(state.moves[state.moves.length - 1]);
168+
return opponent(state.moves[state.moves.length - 1].player);
169169
}
170170
```
171171

@@ -185,7 +185,7 @@ As such the log length is the number of moves + 1 if there is no winner, and the
185185

186186
```ts
187187
export function logLength(state: GameState): number {
188-
return 1 + moves.length + (state.winner !== undefined ? 1 : 0);
188+
return 1 + state.moves.length + (state.winner !== undefined ? 1 : 0);
189189
}
190190
```
191191

0 commit comments

Comments
 (0)