Skip to content

Commit

Permalink
test(test.js): fixed TicTacToe instantiation in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdcvlsc committed Jun 30, 2023
1 parent 9955a17 commit e0f32a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions public/TicTacToe.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TicTacToe {
this.grid = (options?.gridLength) ? options.gridLength : 3;

let pieceWinCount = (options?.winCount) ? options.winCount : 3;

if (pieceWinCount > this.grid) {
pieceWinCount = this.grid;
}
Expand All @@ -34,9 +34,9 @@ class TicTacToe {

this.winner = 0;

this.board = new Uint8Array(gridLength * gridLength);
this.board = new Uint8Array(this.grid * this.grid);
this.currentPlayer = P1;
this.turns = gridLength * gridLength;
this.turns = this.grid * this.grid;

this.makeMove = this.makeMove.bind(this);
this.makeComputerMove = this.makeComputerMove.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TicTacToe, NA, P1, P2 } from './public/TicTacToe.js';

const t = new TicTacToe(3);
const t = new TicTacToe({gridLength: 3});
let failedTests = 0;

const winners = [NA, P1, P1, P1, P1, P1, P1, P2, P2, P2, P2, P2, P2, P1, P1, P2, P2];
Expand Down

0 comments on commit e0f32a6

Please sign in to comment.