Skip to content

Commit

Permalink
Merge pull request #68 from boardgamers/randomboolean-patch-1
Browse files Browse the repository at this point in the history
bugfix other typos in tictactoe.md ts examples
  • Loading branch information
coyotte508 authored Feb 5, 2024
2 parents 4e5e748 + 9abfbb9 commit 741eecd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/docs/docs/guide/tictactoe.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ function winner(board: Board): Player | undefined {
Then we add that info in the `move` function:

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

Expand Down Expand Up @@ -165,7 +165,7 @@ export function currentPlayer(state: GameState): Player {
return 0;
}

return opponent(state.moves[state.moves.length - 1]);
return opponent(state.moves[state.moves.length - 1].player);
}
```

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

```ts
export function logLength(state: GameState): number {
return 1 + moves.length + (state.winner !== undefined ? 1 : 0);
return 1 + state.moves.length + (state.winner !== undefined ? 1 : 0);
}
```

Expand Down

0 comments on commit 741eecd

Please sign in to comment.