Corrections

Le résultat s'actualise quand on change l'ordre dans la pile
La vérification de l'objectif est fonctionnelle
Un son est joué quand on obtient le résultat (sera désactivable à l'avenir)
correction-resultat
adplantade 5 years ago
parent f6fb679692
commit ff7218186b

@ -180,7 +180,7 @@
{ {
tab1.forEach(element => { tab1.forEach(element => {
if(typeof element!= "boolean") if(Array.isArray(element))
{ {
tabTotal.push(element); tabTotal.push(element);
} }
@ -189,7 +189,7 @@
if(tab2[0]){ if(tab2[0]){
tab2.forEach(element => { tab2.forEach(element => {
if(typeof element!= "boolean") if(Array.isArray(element))
{ {
colors.forEach(col => { colors.forEach(col => {
test=[element[0],element[1],col]; test=[element[0],element[1],col];
@ -206,7 +206,7 @@
{ {
tab3.forEach(element => { tab3.forEach(element => {
if(typeof element!= "boolean"){ if(Array.isArray(element)){
colors.forEach(col => { colors.forEach(col => {
test=[element[0],element[1],col]; test=[element[0],element[1],col];
if(!exists) if(!exists)
@ -221,7 +221,7 @@
if(tab4[0]){ if(tab4[0]){
tab4.forEach(element => { tab4.forEach(element => {
if(typeof element!= "boolean") if(Array.isArray(element))
{ {
colors.forEach(col => { colors.forEach(col => {
test=[element[0],element[1],col]; test=[element[0],element[1],col];
@ -239,30 +239,15 @@
} }
else{ else{
tabObjCmp=[]; tabObjCmp=[];
tabObj[0].forEach(element => { for(count=1;count<tabObj[0].length;count++)
if(typeof element!= "boolean")
{ {
tabObjCmp.push(element); tabObjCmp.push(tabObj[0][count]);
} }
}) for(tabCount=1;tabCount<tabObj.length;tabCount++)
tabObj[1].forEach(element => {
if(typeof element!= "boolean")
{ {
colors.forEach(col => { for(elmCount=1;elmCount<tabObj[tabCount].length;elmCount++)
test=[element[0],element[1],col];
if(!exists)
exists=!tabObjCmp.every(unique);
})
if(!exists)
tabObjCmp.push(element);
exists=false;
}
})
tabObj[2].forEach(element => {
if(typeof element!= "boolean")
{ {
element=tabObj[tabCount][elmCount];
colors.forEach(col => { colors.forEach(col => {
test=[element[0],element[1],col]; test=[element[0],element[1],col];
if(!exists) if(!exists)
@ -272,22 +257,7 @@
tabObjCmp.push(element); tabObjCmp.push(element);
exists=false; exists=false;
} }
})
tabObj[3].forEach(element => {
if(typeof element!= "boolean")
{
colors.forEach(col => {
test=[element[0],element[1],col];
if(!exists)
exists=!tabObjCmp.every(unique);
})
if(!exists)
tabObjCmp.push(element);
exists=false;
} }
})
} }
} }
@ -441,10 +411,16 @@
if(tabTotal.length==tabObjCmp.length) if(tabTotal.length==tabObjCmp.length)
{ {
console.log("bon nombre, tab total.l="+tabTotal.length); console.log("bon nombre, tab total.l="+tabTotal.length);
var verifTab=[];
verifTab=copyMDArray(tabTotal);
for(i=0;i<tabTotal.length;i++) for(i=0;i<tabTotal.length;i++)
{ {
exists*tabTotal[i].toString()==tabObjCmp[i].toString(); const result = verifTab.filter(point => point.toString()==tabObjCmp[i].toString());
console.log(tabTotal[i].toString()+"=="+tabObjCmp[i].toString()+" : "+exists); exists*=result.length;
console.log("long : "+ result.length + "ling : "+verifTab.length);
} }
} }
else else
@ -455,6 +431,8 @@
if(exists) if(exists)
{ {
var audio = new Audio('ress/Jewel4.mp3');
audio.play();
console.log("OK"); console.log("OK");
generateEasy(); generateEasy();
} }
@ -472,8 +450,8 @@
//[fromTab,toTab]=[toTab,fromTab]; //[fromTab,toTab]=[toTab,fromTab];
toutDessiner(fromTab,eval("canvas"+from),eval("ctx"+from)); toutDessiner(fromTab,eval("canvas"+from),eval("ctx"+from));
toutDessiner(toTab,eval("canvas"+to),eval("ctx"+to)); toutDessiner(toTab,eval("canvas"+to),eval("ctx"+to));
toutDessiner(tabTotal,canvasT,ctxT);
empiler(); empiler();
toutDessiner(tabTotal,canvasT,ctxT);
} }

Binary file not shown.
Loading…
Cancel
Save