|
|
@ -65,7 +65,7 @@ function selectField(field){
|
|
|
|
somethingIsSelected = true;
|
|
|
|
somethingIsSelected = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!somethingIsSelected && (((field.piece === 1 || field.piece === 11) && turnTotal%2 === 1)||((field.piece === 2 || field.piece === 22) && turnTotal%2 === 0))) {
|
|
|
|
if(!somethingIsSelected && !gameOver && (((field.piece === 1 || field.piece === 11) && turnTotal%2 === 1)||((field.piece === 2 || field.piece === 22) && turnTotal%2 === 0))) {
|
|
|
|
field.style.backgroundColor = "rgb(16,43,202, 0.3)";
|
|
|
|
field.style.backgroundColor = "rgb(16,43,202, 0.3)";
|
|
|
|
field.selected = 1;
|
|
|
|
field.selected = 1;
|
|
|
|
if(field.piece === 1 || field.piece === 11){
|
|
|
|
if(field.piece === 1 || field.piece === 11){
|
|
|
@ -307,4 +307,21 @@ function checkWinCondition(){
|
|
|
|
document.getElementById("turnTotal").innerText = "Game Over!";
|
|
|
|
document.getElementById("turnTotal").innerText = "Game Over!";
|
|
|
|
document.getElementById("turnPlayer").innerText = "O Won!";
|
|
|
|
document.getElementById("turnPlayer").innerText = "O Won!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(gameOver){
|
|
|
|
|
|
|
|
for(let i = 0; i < 64; i++){
|
|
|
|
|
|
|
|
fieldId = i.toString();
|
|
|
|
|
|
|
|
if((document.getElementById("field"+fieldId).piece === 1 || document.getElementById("field"+fieldId).piece === 11) && winner === 1){
|
|
|
|
|
|
|
|
document.getElementById("field"+fieldId).style.backgroundColor = "rgb(33,157,35, 0.3)"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if((document.getElementById("field"+fieldId).piece === 1 || document.getElementById("field"+fieldId).piece === 11) && winner === 2){
|
|
|
|
|
|
|
|
document.getElementById("field"+fieldId).style.backgroundColor = "rgb(227,8,8, 0.3)"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if((document.getElementById("field"+fieldId).piece === 2 || document.getElementById("field"+fieldId).piece === 22) && winner === 1){
|
|
|
|
|
|
|
|
document.getElementById("field"+fieldId).style.backgroundColor = "rgb(227,8,8, 0.3)"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if((document.getElementById("field"+fieldId).piece === 2 || document.getElementById("field"+fieldId).piece === 22) && winner === 2){
|
|
|
|
|
|
|
|
document.getElementById("field"+fieldId).style.backgroundColor = "rgb(33,157,35, 0.3)"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|