|
|
@ -25,7 +25,7 @@ let scoreO = 0;
|
|
|
|
let scoreCounterO = 100;
|
|
|
|
let scoreCounterO = 100;
|
|
|
|
let gameOver = false;
|
|
|
|
let gameOver = false;
|
|
|
|
let winner;
|
|
|
|
let winner;
|
|
|
|
let highScore;
|
|
|
|
let highScore = 0;
|
|
|
|
let allowHSCookies;
|
|
|
|
let allowHSCookies;
|
|
|
|
let saveChoiceCookie;
|
|
|
|
let saveChoiceCookie;
|
|
|
|
let somethingIsSelected = false;
|
|
|
|
let somethingIsSelected = false;
|
|
|
@ -450,10 +450,12 @@ function checkWinCondition(){
|
|
|
|
} else if(allowHSCookies && parseInt(highScore) < scoreO){
|
|
|
|
} else if(allowHSCookies && parseInt(highScore) < scoreO){
|
|
|
|
document.cookie = "highScore=" + scoreO + "; expires=Thu, 5 Dec 2030 12:00:00 UTC";
|
|
|
|
document.cookie = "highScore=" + scoreO + "; expires=Thu, 5 Dec 2030 12:00:00 UTC";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(allowHSCookies) {
|
|
|
|
highScore = getCookie("highScore");
|
|
|
|
highScore = getCookie("highScore");
|
|
|
|
document.getElementById("highScore").innerText = "Highscore: " + highScore;
|
|
|
|
document.getElementById("highScore").innerText = "Highscore: " + highScore;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
function score (field){
|
|
|
|
function score (field){
|
|
|
|
if(field.piece === 0 && turnPlayer === "Player-Turn: X" && scoreCounterX > 10){
|
|
|
|
if(field.piece === 0 && turnPlayer === "Player-Turn: X" && scoreCounterX > 10){
|
|
|
|
scoreCounterX -= 10;
|
|
|
|
scoreCounterX -= 10;
|
|
|
|