pisouvigne 5 years ago
parent 15687ed943
commit 82c784dedd

@ -51,7 +51,7 @@
<hr id="hr">
<div id="selectionVanillaContainer">
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('tuto', this)">
<div class="border background dys listenerHover vanillaElement" onclick="wait('vanillaFacile', this)">
<a>Facile</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
@ -63,7 +63,7 @@
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('tuto', this)">
<div class="border background dys listenerHover vanillaElement" onclick="wait('vanillaMoyen', this)">
<a>Moyen</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
@ -74,7 +74,8 @@
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('tuto', this)">
<div class="border background dys listenerHover vanillaElement"
onclick="wait('vanillaImpossible', this)">
<a>Impossible</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
@ -85,7 +86,7 @@
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('tuto', this)">
<div class="border background dys listenerHover vanillaElement" onclick="wait('vanillaInfini', this)">
<a>Mode Infini</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>

@ -682,8 +682,10 @@ function nextLevel(mode) {
niveauActuel++;
if (mode != undefined && mode != null && mode === "tuto") {
launchTuto();
} else {
} else if (mode === "vanilla" || mode === "normal") {
launchGameOne(mode);
} else if (mode === "vanillaFacile") {
launchFacileGameOne(mode);
}
}
@ -825,15 +827,26 @@ function goToSelection(btn) {
function vanillaSelection() {
hideDiv(document.querySelector("#levelSelectionPage"));
showDiv(document.querySelector("#VanillalevelSelectionPage"));
document.querySelectorAll(".vanillaElement").forEach(function (element) {
if (element.children[0].innerHTML !== "")
element.children[1].className = "fa fa-play";
});
}
function playVanilla() {
hideDiv(document.querySelector("#levelSelectionPage"));
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchGameOne("vanilla");
}
function playFacileVanilla() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileGameOne("vanillaFacile");
}
function modeTuto() {
hideDiv(document.querySelector("#levelSelectionPage"));
showDiv(document.querySelector("#playPage"));
@ -870,12 +883,20 @@ function wait(mode, btn) {
var time = 300;
spin(btn);
switch (mode) {
case "vanillaInfini":
setTimeout(playVanilla, time);
setMode("Vanilla Infini");
break;
case "vanillaFacile":
setTimeout(playFacileVanilla, time);
setMode("Vanilla Facile");
break;
case "normal":
setTimeout(playNormal, time);
setMode("Normal");
break;
case "vanilla":
setTimeout(playVanilla, time);
setTimeout(vanillaSelection, time);
setMode("Vanilla")
break;
case "perso":
@ -1052,6 +1073,101 @@ function launchGameOne(mode) {
}
}
function launchFacileGameOne(mode) {
document.querySelector(".niveau").innerHTML = niveauActuel + " / 25";
document.querySelector("#win_pannel").style.display = "none";
timer.stop();
timer.reset();
resetAllTabs(false);
var col = [];
var matchs = [];
var porteLogique = [];
var time = 20;
switch (niveauActuel) {
case 1:
col = [2, 1];
porteLogique = [[true, "et"], [true, "ou"]];
break;
case 2:
col = [2, 2];
porteLogique = [[true, "et"], [true, "ou"]];
break;
case 3:
col = [3, 2];
matchs = [[1, 2]];
porteLogique = [[true, "et"], [true, "ou"]];
break;
case 4:
col = [3, 2];
porteLogique = [[true, "et"], [true, "inv"]];
break;
case 5:
col = [3, 3];
matchs = [[1, 2]];
porteLogique = [[true, "et"], [true, "inv"]];
break;
case 7:
case 6:
col = [4, 3];
matchs = [[1, 2]];
porteLogique = [[true, "et"], [true, "inv"], [true, "ou"]];
break;
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
col = [5, 4, 3];
matchs = [[1, 3], [2, 2]];
porteLogique = [[true, "et"], [true, "ou"], [true, "inv"]];
break;
}
for (let i = 0; i < 200; i++) {
tentative = i;
if (generator(matchs, col, porteLogique, mode, time) === false)
break;
}
if (mode === "normalFacile") {
switchsInfoCopy.forEach(function (sw) {
if (getRandomArbitrary(0, 3) === 1) {
activeSwitch(sw.id);
checkAllSortieLogique();
}
});
}
while (checkIfEnd()) {
for (let i = 0; i < 200; i++) {
tentative = i;
if (generator(matchs, col, porteLogique, mode, time) === false)
break;
}
if (mode === "normalFacile") {
switchsInfoCopy.forEach(function (sw) {
switchsInfoCopy.forEach(function (sw) {
if (getRandomArbitrary(0, 3) === 1) {
activeSwitch(sw.id);
checkAllSortieLogique();
}
});
});
}
}
}
function launchTuto() {
document.querySelector("#win_pannel").style.display = "none";
document.querySelector(".niveau").innerHTML = niveauActuel;

Loading…
Cancel
Save