Skip to content

Commit

Permalink
Merge pull request sabrina-aip#29 from jasger9000/fix-logical-AND
Browse files Browse the repository at this point in the history
Fix logical-AND operators
  • Loading branch information
sabrina-aip authored Feb 22, 2024
2 parents ebcee95 + 6369879 commit f23474c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions assets/scripts/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function deleteLetter () {
// CHECK IF GUESS IS CORRECT

function guessPreprocess(){
if ((lastActiveWord != null) & (activeWord==null)) {
if (lastActiveWord != null && activeWord==null) {
activeWord = lastActiveWord;
checkGuess()
return;
Expand Down Expand Up @@ -295,10 +295,10 @@ function updatePlayer(playerLst, activePlayer) {
}

playerLst.forEach((player) => {
if ((!player[0].classList.contains("submitted")) & player[0] != activePlayer[0]) {
if (!player[0].classList.contains("submitted") && player[0] != activePlayer[0]) {
player[0].classList.remove("clicked", "fa-circle-stop");
stopSound(player[1]);
} else if ((!player[0].classList.contains("submitted")) & player[0] == activePlayer[0]) {
} else if (!player[0].classList.contains("submitted") && player[0] == activePlayer[0]) {
activePlayer[0].classList.add("clicked","fa-circle-stop");
activePlayer[1].play();
}
Expand Down Expand Up @@ -390,7 +390,7 @@ document.addEventListener("keyup", (e) => {
return;
}

if (pressedKey === "Backspace" & attemptStr.length != 0) {
if (pressedKey === "Backspace" && attemptStr.length != 0) {
document.querySelector(`#${pressedKey}`).classList.add("clicked")
setTimeout(() => {
setTimeout(document.querySelector(`#${pressedKey}`).classList.remove("clicked"));
Expand Down
10 changes: 5 additions & 5 deletions assets/scripts/practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function deleteLetter () {
}

function guessPreprocess() {
if ((lastActiveWord != null) & (activeWord==null)) {
if (lastActiveWord != null && activeWord==null) {
activeWord = lastActiveWord;
checkGuess()
return;
Expand Down Expand Up @@ -204,10 +204,10 @@ function updatePlayer(playerLst, activePlayer) {
}

playerLst.forEach((player) => {
if ((!player[0].classList.contains("submitted")) & player[0] != activePlayer[0]) {
if (!player[0].classList.contains("submitted") && player[0] != activePlayer[0]) {
player[0].classList.remove("clicked", "fa-circle-stop");
stopSound(player[1]);
} else if ((!player[0].classList.contains("submitted")) & player[0] == activePlayer[0]) {
} else if (!player[0].classList.contains("submitted") && player[0] == activePlayer[0]) {
activePlayer[0].classList.add("clicked","fa-circle-stop");
activePlayer[1].play();
}
Expand Down Expand Up @@ -284,7 +284,7 @@ document.addEventListener("keyup", (e) => {
return;
}

if (pressedKey === "Backspace" & attemptStr.length != 0) {
if (pressedKey === "Backspace" && attemptStr.length != 0) {
document.querySelector(`#${pressedKey}`).classList.add("clicked")
setTimeout(() => {
setTimeout(document.querySelector(`#${pressedKey}`).classList.remove("clicked"));
Expand All @@ -305,4 +305,4 @@ document.addEventListener("keyup", (e) => {
}
})

checkLevel(level)
checkLevel(level)
10 changes: 5 additions & 5 deletions assets/scripts/spelloff.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function deleteLetter () {
}

function guessPreprocess() {
if ((lastActiveWord != null) & (activeWord==null)) {
if (lastActiveWord != null && activeWord==null) {
activeWord = lastActiveWord;
checkGuess()
return;
Expand Down Expand Up @@ -188,10 +188,10 @@ function updatePlayer(playerLst, activePlayer) {
}

playerLst.forEach((player) => {
if ((!player[0].classList.contains("submitted")) & player[0] != activePlayer[0]) {
if (!player[0].classList.contains("submitted") && player[0] != activePlayer[0]) {
player[0].classList.remove("clicked", "fa-circle-stop");
stopSound(player[1]);
} else if ((!player[0].classList.contains("submitted")) & player[0] == activePlayer[0]) {
} else if (!player[0].classList.contains("submitted") && player[0] == activePlayer[0]) {
activePlayer[0].classList.add("clicked","fa-circle-stop");
activePlayer[1].play();
}
Expand Down Expand Up @@ -267,7 +267,7 @@ document.addEventListener("keyup", (e) => {
return;
}

if (pressedKey === "Backspace" & attemptStr.length != 0) {
if (pressedKey === "Backspace" && attemptStr.length != 0) {
document.querySelector(`#${pressedKey}`).classList.add("clicked")
setTimeout(() => {
setTimeout(document.querySelector(`#${pressedKey}`).classList.remove("clicked"));
Expand All @@ -288,4 +288,4 @@ document.addEventListener("keyup", (e) => {
}
})

checkLevel("youtube")
checkLevel("youtube")
6 changes: 3 additions & 3 deletions assets/scripts/wordLstGenerator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions assets/scripts/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function checkLevel(level){
function updateWord(){
if (wordCounter < 10){
levelPath = "levelOneNEW"
} else if ((wordCounter >= 10) && (wordCounter<20)){
} else if (wordCounter >= 10 && wordCounter<20){
levelPath = "levelTwoNEW"
}else if ((wordCounter >= 20) && (wordCounter<100)){
}else if (wordCounter >= 20 && wordCounter<100){
levelPath = "levelThreeNEW"
}
wordLst = genYoutubeWordLst()
Expand Down Expand Up @@ -118,7 +118,7 @@ function deleteLetter () {
}

function guessPreprocess() {
if ((lastActiveWord != null) & (activeWord==null)) {
if (lastActiveWord != null && activeWord==null) {
activeWord = lastActiveWord;
checkGuess()
return;
Expand Down Expand Up @@ -179,10 +179,10 @@ function updatePlayer(playerLst, activePlayer) {
}

playerLst.forEach((player) => {
if ((!player[0].classList.contains("submitted")) & player[0] != activePlayer[0]) {
if (!player[0].classList.contains("submitted") && player[0] != activePlayer[0]) {
player[0].classList.remove("clicked", "fa-circle-stop");
stopSound(player[1]);
} else if ((!player[0].classList.contains("submitted")) & player[0] == activePlayer[0]) {
} else if (!player[0].classList.contains("submitted") && player[0] == activePlayer[0]) {
activePlayer[0].classList.add("clicked","fa-circle-stop");
activePlayer[1].play();
}
Expand Down Expand Up @@ -258,7 +258,7 @@ document.addEventListener("keyup", (e) => {
return;
}

if (pressedKey === "Backspace" & attemptStr.length != 0) {
if (pressedKey === "Backspace" && attemptStr.length != 0) {
document.querySelector(`#${pressedKey}`).classList.add("clicked")
setTimeout(() => {
setTimeout(document.querySelector(`#${pressedKey}`).classList.remove("clicked"));
Expand All @@ -279,4 +279,4 @@ document.addEventListener("keyup", (e) => {
}
})

checkLevel("youtube")
checkLevel("youtube")

0 comments on commit f23474c

Please sign in to comment.