Skip to content

Commit

Permalink
change player symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirurgo authored Oct 17, 2017
1 parent c55c722 commit 09679ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tic-tac-toe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = class TicTacToe {
constructor() {
let player = 'X', field = Array(9).fill(null)
let player = 'x', field = Array(9).fill(null)
const winSets = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]],
index = (row, col) => 3*row + col,
checkWin = set => set.map(this.getFieldValue).join('').match(/(.)\1{2}/)
Expand All @@ -11,6 +11,6 @@ module.exports = class TicTacToe {
this.isDraw = () => this.noMoreTurns() && !this.getWinner()
this.isFinished = () => this.isDraw() || !!this.getWinner()
this.nextTurn = (row, col) => !field[index(row, col)] ?
(field[index(row, col)] = player, player = player == 'X' ? 'O' : 'X') : null
(field[index(row, col)] = player, player = player == 'x' ? 'o' : 'x') : null
}
}
}

0 comments on commit 09679ee

Please sign in to comment.