Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[newbie] Faire une liste en javascript ?

1 réponse
Avatar
Olve
Bonjour,

Oui, j'en suis à mes armes en javascript --

Voilà (une simplication de), ce que j'ai écrit :

function coup(myPx, myPy, myQx, myQy, myRx, myRy) {
/* P + Q -> R */
this.Px = myPx; this.Py = myPy;
this.Qx = myQx; this.Qy = myQy;
this.Rx = myRx; this.Ry = myRy;
}

function CalculeCoups(myPlateau){
var theCoups = Array();
var acoup;

for( x = 0; x < 7; x++){
for( y = 0; y < 7-2; y++){
if((myPlateau[x+y] != 9)
&&(myPlateau[x+y+1] != 9)
&&(myPlateau[x+y+2] != 9)){
acoup = new coup(x, y, x, y+1, x, y+2);
theCoups.push(acoup);
};}}
};

Oui, ça marche pas :)
Une idée ?
Merci d'avance !
A.O.

1 réponse

Avatar
Olve
Résolu :) C'est la fête :) A.O.