diff --git a/SwichGIT/src/js/main.js b/SwichGIT/src/js/main.js index 610eb8f..84dfb2d 100644 --- a/SwichGIT/src/js/main.js +++ b/SwichGIT/src/js/main.js @@ -586,17 +586,17 @@ function creaMatrice(row, column) { var Cox1, Coy1, Cox2, Coy2; - Cox1 = getRandom(0, 2); - Coy1 = getRandom(0, 3); + Cox1 = getRandom(0, column - 1); + Coy1 = getRandom(0, row - 1); myMatrice[Cox1][Coy1] = 1; - Cox2 = getRandom(0, 2); - Coy2 = getRandom(0, 3); + Cox2 = getRandom(0, column - 1); + Coy2 = getRandom(0, row - 1); while (Cox2 == Cox1 && Coy1 == Coy2) { - Cox2 = getRandom(0, 2); - Coy2 = getRandom(0, 3); + Cox2 = getRandom(0, column - 1); + Coy2 = getRandom(0, row - 1); } myMatrice[Cox2][Coy2] = 2; @@ -663,7 +663,7 @@ function chercherCombinaison() { } function test() { - printCombinations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 3); + printCombinations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 12); } function printCombinations(array, p) { @@ -684,9 +684,9 @@ function printCombinations(array, p) { for (var j = 0; j < combinations.length; j++) { combTest.push(deckPartie[combinations[j]]); //window.alert("Matrice ajouté num" + j + " :" + deckPartie[combinations[j]].getMatrice); - //console.log("i"+j +" :"+ combinations[j]); + console.log("i"+j +" :"+ combinations[j]); } - //console.log("matrice début ex: "+combTest[0].getMatrice); + console.log("matrice début ex: "+combTest[0].getMatrice); console.log("Cartes selectionnées :(en partant de indice 0) :") console.log(combinations.join(" ")); console.log("----- taille :" + combTest.length + " -------"); @@ -697,6 +697,7 @@ function printCombinations(array, p) { } } run(0, 0); + window.alert("fin test " + k + " cartes" ) } window.alert("nb combi :" + Cptsolution); }