Skip to content

Commit

Permalink
added cross mechanism to tic tac toe
Browse files Browse the repository at this point in the history
  • Loading branch information
daisyzhang2024 committed Nov 6, 2023
1 parent 9e891d5 commit 3d38184
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions _posts/2023-10-24-Tic_tac_toe_game.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ function checkScore() {
allSquares.forEach(square => square.replaceWith(square.cloneNode(true)))
return
}
const crossWins = array.every(cell =>
allSquares[cell].firstChild?.classList.contains('cross'))
if (crossWins) {
infoDisplay.textContent = "Cross Wins!"
allSquares.forEach(square => square.replaceWith(square.cloneNode(true)))
return
}

})

Expand Down

0 comments on commit 3d38184

Please sign in to comment.