Skip to content

Commit

Permalink
hotfix(logic):
Browse files Browse the repository at this point in the history
Iranian path for issue #1
(It is possible to clear the screen before the end of the game)
  • Loading branch information
miladkh7 committed May 17, 2021
1 parent ca396bf commit 76fba3f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const TicToc={
this.cells[i].textContent='';
this.cells[i].className="cell"
}
console.log(this.board)
// console.log(this.board)
this.board.addEventListener('click',(e)=>this.handleClick(e));
// this.toggleTurn()
},
Expand Down Expand Up @@ -126,9 +126,15 @@ const TicToc={
//ToDo:use player as class and
let [someOneWin,winner]=this.CheckWin(this.currentPlayerIndex)
if(someOneWin) {
alert(this.currentPlayerMark + ' wons!');
this.init(this.gameSize)
return

//#FixMe:It is possible to clear the screen before the end of the game
setTimeout(()=> {
alert(this.currentPlayerMark + ' wons!');
this.init(this.gameSize)
return

},100)

}
if(this.CheckTie()){
alert(' Tie!');
Expand Down

0 comments on commit 76fba3f

Please sign in to comment.