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.
15 lines
652 B
15 lines
652 B
function vierDiagonalRechts(allSpaltenArray) {
|
|
var Gewinner =0;
|
|
for (let i = 0; i <= allSpaltenArray.length -3; i++) {
|
|
for (let j = 0; j <= allSpaltenArray[0].length -3; j++) {
|
|
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;
|
|
}
|
|
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 = vierDiagonalRechts;
|