You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
713 B
19 lines
713 B
function vierDiagonalLinks(allSpaltenArray) {
|
|
var Gewinner =0;
|
|
for (let i = 3; i <= allSpaltenArray.length; i++) {
|
|
for (let j = 0; j <= allSpaltenArray[0].length -3; j++) {
|
|
|
|
//Spieler Gruen
|
|
if (allSpaltenArray[j][i]===1 && allSpaltenArray[j+1][i-1]===1 && allSpaltenArray[j+2][i-2]===1 && allSpaltenArray[j+3][i-3]===1) {
|
|
Gewinner = 1;
|
|
}
|
|
|
|
//Spieler Rot
|
|
if (allSpaltenArray[j][i]===2 && allSpaltenArray[j+1][i-1]===2 && allSpaltenArray[j+2][i-2]===2 && allSpaltenArray[j+3][i-3]===2) {
|
|
Gewinner = 2;
|
|
}
|
|
}
|
|
}
|
|
return Gewinner;
|
|
}
|
|
module.exports = vierDiagonalLinks;
|