diff --git a/SwichGIT/MultiFinal/index.php b/SwichGIT/MultiFinal/index.php index 4b40382..7e5c61e 100644 --- a/SwichGIT/MultiFinal/index.php +++ b/SwichGIT/MultiFinal/index.php @@ -712,14 +712,16 @@ require("ConnexionBDD.php");

Identifiant partie : $idpartie

diff --git a/SwichGIT/MultiFinal/js/main.js b/SwichGIT/MultiFinal/js/main.js index c119db6..285e5f0 100644 --- a/SwichGIT/MultiFinal/js/main.js +++ b/SwichGIT/MultiFinal/js/main.js @@ -129,7 +129,7 @@ class Carte { } } } - console.log("cartesPOS: ",carteselectPos); + //console.log("cartesPOS: ",carteselectPos); var laCarte; for (var i = 0; i < deckPartie.length; i++) { if (this.id == deckPartie[i].identifiant) { @@ -439,7 +439,7 @@ function lancerGameMulti() { for (var i = 0; i < deckPartie.length; i++) { var ajt = deckPartie[i].getMatrice[0] + deckPartie[i].getMatrice[1] + deckPartie[i].getMatrice[2]; listecartes.push(ajt); - console.log(ajt); + //console.log(ajt); } $(document).ready(function () { @@ -487,7 +487,7 @@ function convertCarteToData() { ajt = uneMatrice[0] + '' + uneMatrice[1] + '' + uneMatrice[2];//une fois matrice vierge complétée on transforme ça en data listecartes.push(ajt); - console.log(ajt); + //console.log(ajt); } $(document).ready(function () { @@ -541,7 +541,7 @@ function ConvertUneCarte(carte){ function ConvertInttoCarte(ListeDesCartes){ - console.log("LC",ListeDesCartes); + //console.log("LC",ListeDesCartes); if(ListeDesCartes.length==0){ console.log("Vide"); } @@ -555,21 +555,21 @@ function ConvertInttoCarte(ListeDesCartes){ if(ListeDesCartes[j][i]==1){ var premierefigure= new Figure(TypeFigure.Petit,FormeFigure.Rond,Math.floor(i/4),(i%4)); lesfigure.push(premierefigure); - console.log("cc1",j," ",i); + //console.log("cc1",j," ",i); } else if(ListeDesCartes[j][i]==2){ var deuxiemefigure = new Figure(TypeFigure.Moyen,FormeFigure.Rond,Math.floor(i/4),(i%4)); lesfigure.push(deuxiemefigure); - console.log("cc2",j," ",i); + //console.log("cc2",j," ",i); } } //pb? var carte= new Carte(lescartes.length,lesfigure,4,3); - console.log("MAMAN2",j," ",carte); + //console.log("MAMAN2",j," ",carte); lescartes.push(carte); } - console.log("LC2",lescartes); + //console.log("LC2",lescartes); deckPartie = lescartes; afficherCartes(deckPartie); console.log("--Conversion réussie--"); @@ -583,8 +583,8 @@ function reselectCartes() { carteselectPos.forEach((pos) => { var lacarte = "card"+pos; var numeroCarte = pos; - console.log("lacarte: ",lacarte); - console.log(deckPartie[numeroCarte].get); + //console.log("lacarte: ",lacarte); + //console.log(deckPartie[numeroCarte].get); document.getElementById(lacarte).style.boxShadow = "0 0 1vw red, 0 0 1vw red"; }); } @@ -592,8 +592,8 @@ function reselectCartes() { for (var i=0; i 16) { + //On prend une autre carte aléatoire dans tas du jeu + var index2 = getRandom(0, TasDuJEU.length - 1) + //var dejaPresente = false; + //Permet de savoir si la carte est deja dans la liste + // for (var j = 0; j < deckPartie.length; j++) { + // if (TasDuJEU[index2].identifiant == deckPartie[j].identifiant) { + // dejaPresente = true; + // } + // } + + deckPartie[carteselectPos[0]]=TasDuJEU[index2]; + TasDuJEU.splice(index2,1); + + //on recommmence jusqu'à obtenri une carte pas dans le tas de jeu + // while (dejaPresente == true) { + // index2 = getRandom(0, TasDuJEU.length - 1) + // dejaPresente = false;//Permet de savoir si la carte est deja dans la liste + // for (var j = 0; j < deckPartie.length; j++) { + // if (TasDuJEU[index2].identifiant == deckPartie[j].identifiant) { + // dejaPresente = true; + // } + // } + // } + + // unIndex = deckPartie.indexOf(carteselect[0]); + // deckPartie[unIndex] = TasDuJEU[index2]; + // new2cartes.push(TasDuJEU[index2]); + } else { + // si il y a moins de 16 cartes on enlève juste + deckPartie.splice(carteselect[0],1); + // unIndex = deckPartie.indexOf(carteselect[0]); + // deckPartie.splice(unIndex, 1); + } + carteselectPos.shift(); + carteselect.shift(); + } + afficherCartes(deckPartie); + return new2cartes; +} function changerlesCartes() { while (carteselect.length != 0) { @@ -966,7 +1016,7 @@ function creaMatriceVierge(row, column) { myMatrice2[i][j] = 0; } } - console.log("BUG1 ",myMatrice2); + //console.log("BUG1 ",myMatrice2); //var cartecopie = copieMatrice(myMatrice,myMatrice.length,myMatrice[0].length) return myMatrice2; } @@ -1335,13 +1385,14 @@ function testerCartesMulti() { for (var i = 0; i < tab.length; i++) { tabCode.push(tab[i].code); } + for (var i = 0; i < tab.length; i++) { if (tab[i].code == carteselect.length) { solution = false; cpt = cpt + 20 * copie.length; lesPoints += carteselect.length; document.getElementById("affPoints").textContent = 'Score : ' + lesPoints; - var new2Cartes=changerlesCartesDeTasDeJeu(); + var new2Cartes=changerlesCartesDeTasDeJeuMulti(); } } if (solution) { @@ -1385,7 +1436,7 @@ function testerCartesMulti() { ajt = uneMatrice[0]+uneMatrice[1]+uneMatrice[2];//une fois matrice vierge complétée on transforme ça en data listecartes.push(ajt); - console.log(ajt); + //console.log(ajt); } //console.log("LISTE BUG1: ",listecartes); diff --git a/SwichGIT/MultiFinal/mysqlitedb.db b/SwichGIT/MultiFinal/mysqlitedb.db index 47125b2..08b69b9 100644 Binary files a/SwichGIT/MultiFinal/mysqlitedb.db and b/SwichGIT/MultiFinal/mysqlitedb.db differ