Skip to content

Commit

Permalink
Re-factored ttt.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Murdock9803 authored Jan 2, 2024
1 parent 98cec9a commit a74dfd9
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions Tic-Tac-Toe/ttt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Audio class variables
let ting = new Audio("ting.mp3")
let gameover = new Audio("gameover.mp3")

Expand Down Expand Up @@ -77,29 +76,6 @@ Array.from(boxes).forEach(Element => {
})
})

//Game Logic

let boxes = document.getElementsByClassName("box");
Array.from(boxes).forEach(Element => {
let boxText = Element.querySelector(".box-text");
Element.addEventListener("click", function(){
if (boxText.innerText === ""){
boxText.innerText = turn;
turn = changeTurn();
ting.play();
checkWin();
if (over === false){
document.getElementsByClassName("info")[0].innerText ="Turn for " + turn;
}
else {
for(i=0; i<9; i++){
boxes[i].classList.add("disabled");
}
}
}
})
})


// Reload button
document.querySelector(".restart").addEventListener("click", function(){
Expand Down

0 comments on commit a74dfd9

Please sign in to comment.