tutoriel terminé, fix de l'aléatoire sur le selection des logiques apres fork sur le générateur

master
pisouvigne 5 years ago
parent f4b477b56e
commit 5803efef3c

@ -269,8 +269,8 @@
<br><br> <br><br>
<p><img src="img/txt_en/not.png" class="margin-right"><img src="img/sym/not.png"></p> <p><img src="img/txt_en/not.png" class="margin-right"><img src="img/sym/not.png"></p>
<br><br> <br><br>
<p class="dys info_check" align=right><a class="txt" id="close_helps"></a><input type="checkbox" <p class="dys info_check" align=right>Ne plus afficher les aides <a class="txt"
id="info_check_input" onclick="showInfo();"></p> id="close_helps"></a><input type="checkbox" id="info_check_input" onclick="showInfo();"></p>
</div> </div>
</div> </div>
</div> </div>
@ -284,13 +284,26 @@
<table class="veriteTable dys"> <table class="veriteTable dys">
<tr> <tr>
<th class="border">a</th> <th class="border">a</th>
<th class="border">b</th>
<th class="border">S</th> <th class="border">S</th>
</tr> </tr>
<tr class="veri_true"> <tr class="veri_true">
<td class="border">0</td>
<td class="border">0</td>
<td class="border">1</td>
</tr>
<tr class="veri_false">
<td class="border">1</td>
<td class="border">0</td>
<td class="border">0</td>
</tr>
<tr class="veri_false">
<td class="border">0</td> <td class="border">0</td>
<td class="border">1</td> <td class="border">1</td>
<td class="border">0</td>
</tr> </tr>
<tr class="veri_false"> <tr class="veri_false">
<td class="border">1</td>
<td class="border">1</td> <td class="border">1</td>
<td class="border">0</td> <td class="border">0</td>
</tr> </tr>
@ -298,28 +311,41 @@
<br><br> <br><br>
<p><img src="img/txt_en/nor.png" class="margin-right"><img src="img/sym/nor.png"></p> <p><img src="img/txt_en/nor.png" class="margin-right"><img src="img/sym/nor.png"></p>
<br><br> <br><br>
<p class="dys info_check" align=right><a class="txt" id="close_helps"></a><input type="checkbox" <p class="dys info_check" align=right>Ne plus afficher les aides <a class="txt"
id="info_check_input" onclick="showInfo();"></p> id="close_helps"></a><input type="checkbox" id="info_check_input" onclick="showInfo();"></p>
</div> </div>
</div> </div>
</div> </div>
<div id="firstTimenand" class="modal"> <div id="firstTimeetnon" class="modal">
<div class="modal-content info-content"> <div class="modal-content info-content">
<div class="modal-body border background" align=center> <div class="modal-body border background" align=center>
<span class="close" onclick="closeModal('firstTimenand');demarrerTimer();">&times;</span> <span class="close" onclick="closeModal('firstTimeetnon');demarrerTimer();">&times;</span>
<h1 class="txt dys" id="infoFirstTimenand"></h1> <h1 class="txt dys" id="infoFirstTimeetnon"></h1>
<hr id="hr"> <hr id="hr">
<p class="dys txt margin-global" id="infoFirstTimenandInfo1"></p> <p class="dys txt margin-global" id="infoFirstTimeetnonInfo1"></p>
<table class="veriteTable dys"> <table class="veriteTable dys">
<tr> <tr>
<th class="border">a</th> <th class="border">a</th>
<th class="border">b</th>
<th class="border">S</th> <th class="border">S</th>
</tr> </tr>
<tr class="veri_true"> <tr class="veri_true">
<td class="border">0</td>
<td class="border">0</td> <td class="border">0</td>
<td class="border">1</td> <td class="border">1</td>
</tr> </tr>
<tr class="veri_true">
<td class="border">1</td>
<td class="border">0</td>
<td class="border">1</td>
</tr>
<tr class="veri_true">
<td class="border">0</td>
<td class="border">1</td>
<td class="border">1</td>
</tr>
<tr class="veri_false"> <tr class="veri_false">
<td class="border">1</td>
<td class="border">1</td> <td class="border">1</td>
<td class="border">0</td> <td class="border">0</td>
</tr> </tr>
@ -327,8 +353,8 @@
<br><br> <br><br>
<p><img src="img/txt_en/nand.png" class="margin-right"><img src="img/sym/nand.png"></p> <p><img src="img/txt_en/nand.png" class="margin-right"><img src="img/sym/nand.png"></p>
<br><br> <br><br>
<p class="dys info_check" align=right><a class="txt" id="close_helps"></a><input type="checkbox" <p class="dys info_check" align=right>Ne plus afficher les aides <a class="txt"
id="info_check_input" onclick="showInfo();"></p> id="close_helps"></a><input type="checkbox" id="info_check_input" onclick="showInfo();"></p>
</div> </div>
</div> </div>
</div> </div>

@ -900,14 +900,19 @@ function launchTuto() {
document.querySelector(".niveau").innerHTML = niveauActuel; document.querySelector(".niveau").innerHTML = niveauActuel;
timer.stop(); timer.stop();
timer.reset(); timer.reset();
resetAllTabs(false); if (niveauActuel < 6) {
tuto();
while (checkIfEnd()) {
resetAllTabs(false); resetAllTabs(false);
tuto(); tuto();
while (checkIfEnd()) {
resetAllTabs(false);
tuto();
} }
} else {
hideDiv(document.querySelector("#playPage"));
showDiv(document.querySelector("#mainPage"));
}
} }
function setMode(mode) { function setMode(mode) {

@ -253,7 +253,7 @@ function tuto(niveau) {
firstTime.push("ou"); firstTime.push("ou");
break; break;
case 4: case 4:
firstTime.push("nand"); firstTime.push("etnon");
break; break;
case 5: case 5:
firstTime.push("nonou"); firstTime.push("nonou");
@ -262,29 +262,33 @@ function tuto(niveau) {
finish = true; finish = true;
break; break;
} }
isTuto = false; if (!finish) {
createStage("play_container"); isTuto = false;
stage.add(layer); createStage("play_container");
colonneTot = 3; stage.add(layer);
numberPerColonne = [numberColonne1, numberColonne2, 2]; colonneTot = 3;
var logiqueCount = 0; numberPerColonne = [numberColonne1, numberColonne2, 2];
var logiqueCount = 0;
if (firstTime.length > 0) {
numberColonne1 = 1; if (firstTime.length > 0) {
numberColonne2 = 0; numberColonne1 = 1;
numberPerColonne = [numberColonne1, numberColonne2]; numberColonne2 = 0;
liveColonneNumber.push([]); numberPerColonne = [numberColonne1, numberColonne2];
timeEnd = 20; liveColonneNumber.push([]);
insertLogiqueColonne("logique" + logiqueCount, firstTime[0], 0); timeEnd = 20;
if (allowedInfoPorte) { insertLogiqueColonne("logique" + logiqueCount, firstTime[0], 0);
openModal('firstTime' + firstTime[0]); if (allowedInfoPorte) {
timer.pause(); openModal('firstTime' + firstTime[0]);
timer.pause();
}
} }
logiques.forEach(function (element) {
createLinkAuto(element.name);
});
initEndGame("tuto");
} else {
} }
logiques.forEach(function (element) {
createLinkAuto(element.name);
});
initEndGame("tuto");
} }
@ -318,7 +322,7 @@ function createGameOne(niveau) {
numberColonne2 = 1; numberColonne2 = 1;
timeEnd = 20; timeEnd = 20;
break; break;
//Fin premiere serie //Fin premiere serie
case 5: case 5:
firstTime.push("inv"); firstTime.push("inv");
isNotAllowed = true; isNotAllowed = true;
@ -497,29 +501,35 @@ function generate2(col, matchs, fork) {
} else { } else {
var allowed = []; var allowed = [];
listeLogiqueObj.forEach(function (logique) { listeLogiqueObj.forEach(function (logique) {
if (logique.col === element[0] && logique.same !== element[1]) if (logique.col === element[0] && logique.matchId1 !== element[1])
allowed.push(logique); allowed.push(logique);
}); });
allowed[getRandomArbitrary(0, allowed.length)].matchId2 = element[1]; allowed[getRandomArbitrary(0, allowed.length)].matchId2 = element[1];
} }
i++; i++;
}); });
console.log(listeLogiqueObj);
//Attribution des types //Attribution des types
//num = liste de comptatibilité //num = liste de comptatibilité
let num2 = getRandomArbitrary(0, 5); let num2 = getRandomArbitrary(0, 5);
for (x in compt) { for (x in listeLogiqueObj) {
if (listeLogiqueObj[x].matchId1 !== null) { if (listeLogiqueObj[x].matchId1 !== null) {
if (getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] === null) { if (getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] === null) {
getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] = num2; getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] = num2;
console.log(listeLogiqueObj[x].matchId2);
if (listeLogiqueObj[x].matchId2 !== null && getElementArray(listeLogiqueObj[x].matchId2, listeSame)[1] === null) {
getElementArray(listeLogiqueObj[x].matchId2, listeSame)[1] = num2;
console.log("oui")
}
num2 = getRandomArbitrary(0, 5); num2 = getRandomArbitrary(0, 5);
} else { } else {
listeSame[x] = getElementArray(listeLogiqueObj[x].matchId1, listeSame); listeSame[x] = getElementArray(listeLogiqueObj[x].matchId1, listeSame);
} }
} }
} }
console.log(listeSame);
createStage("play_container"); createStage("play_container");
stage.add(layer); stage.add(layer);
timeEnd = 999; timeEnd = 999;
@ -645,7 +655,7 @@ function getNumberFork(arr, col) {
function getElementArray(one, array) { function getElementArray(one, array) {
retour = null; retour = null;
array.forEach(function (element) { array.forEach(function (element) {
if (element[0] === one && retour === null) { if ((element[0] === one && retour === null)) {
retour = element; retour = element;
} }
}); });

@ -33,7 +33,11 @@ const lang = {
successTitle: "Niveau réussi !", successTitle: "Niveau réussi !",
successInfo: "Vous avez réussi en ", successInfo: "Vous avez réussi en ",
symbole: "Mode symboles", symbole: "Mode symboles",
timerSetting: "Activer la barre timer" timerSetting: "Activer la barre timer",
infoFirstTimenonou: "Porte \"non-ou\"",
infoFirstTimenonouInfo1: "L'opérateur non-ou renvoie VRAI si aucune des entrés est à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimeetnon: "Porte \"non-et\"",
infoFirstTimeetnonInfo1: "L'opérateur non-et renvoie FAUX si les deux entrés sont à 1. Sinon il renvoie VRAI<br><br><br> Voici la table de vérité :",
}, },
en: { en: {

Loading…
Cancel
Save