pisouvigne 5 years ago
parent 15687ed943
commit 82c784dedd

@ -51,7 +51,7 @@
<hr id="hr"> <hr id="hr">
<div id="selectionVanillaContainer"> <div id="selectionVanillaContainer">
<div id="containerVanilla"> <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> <a>Facile</a>
<i class="fa fa-play" aria-hidden="true"></i> <i class="fa fa-play" aria-hidden="true"></i>
</div> </div>
@ -63,7 +63,7 @@
</div> </div>
<div id="containerVanilla"> <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> <a>Moyen</a>
<i class="fa fa-play" aria-hidden="true"></i> <i class="fa fa-play" aria-hidden="true"></i>
</div> </div>
@ -74,7 +74,8 @@
</div> </div>
</div> </div>
<div id="containerVanilla"> <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> <a>Impossible</a>
<i class="fa fa-play" aria-hidden="true"></i> <i class="fa fa-play" aria-hidden="true"></i>
</div> </div>
@ -85,7 +86,7 @@
</div> </div>
</div> </div>
<div id="containerVanilla"> <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> <a>Mode Infini</a>
<i class="fa fa-play" aria-hidden="true"></i> <i class="fa fa-play" aria-hidden="true"></i>
</div> </div>

@ -682,8 +682,10 @@ function nextLevel(mode) {
niveauActuel++; niveauActuel++;
if (mode != undefined && mode != null && mode === "tuto") { if (mode != undefined && mode != null && mode === "tuto") {
launchTuto(); launchTuto();
} else { } else if (mode === "vanilla" || mode === "normal") {
launchGameOne(mode); launchGameOne(mode);
} else if (mode === "vanillaFacile") {
launchFacileGameOne(mode);
} }
} }
@ -825,15 +827,26 @@ function goToSelection(btn) {
function vanillaSelection() { function vanillaSelection() {
hideDiv(document.querySelector("#levelSelectionPage")); hideDiv(document.querySelector("#levelSelectionPage"));
showDiv(document.querySelector("#VanillalevelSelectionPage")); showDiv(document.querySelector("#VanillalevelSelectionPage"));
document.querySelectorAll(".vanillaElement").forEach(function (element) {
if (element.children[0].innerHTML !== "")
element.children[1].className = "fa fa-play";
});
} }
function playVanilla() { function playVanilla() {
hideDiv(document.querySelector("#levelSelectionPage")); hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage")); showDiv(document.querySelector("#playPage"));
niveauActuel = 1; niveauActuel = 1;
timeTot = 0; timeTot = 0;
launchGameOne("vanilla"); launchGameOne("vanilla");
} }
function playFacileVanilla() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileGameOne("vanillaFacile");
}
function modeTuto() { function modeTuto() {
hideDiv(document.querySelector("#levelSelectionPage")); hideDiv(document.querySelector("#levelSelectionPage"));
showDiv(document.querySelector("#playPage")); showDiv(document.querySelector("#playPage"));
@ -870,12 +883,20 @@ function wait(mode, btn) {
var time = 300; var time = 300;
spin(btn); spin(btn);
switch (mode) { switch (mode) {
case "vanillaInfini":
setTimeout(playVanilla, time);
setMode("Vanilla Infini");
break;
case "vanillaFacile":
setTimeout(playFacileVanilla, time);
setMode("Vanilla Facile");
break;
case "normal": case "normal":
setTimeout(playNormal, time); setTimeout(playNormal, time);
setMode("Normal"); setMode("Normal");
break; break;
case "vanilla": case "vanilla":
setTimeout(playVanilla, time); setTimeout(vanillaSelection, time);
setMode("Vanilla") setMode("Vanilla")
break; break;
case "perso": 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() { function launchTuto() {
document.querySelector("#win_pannel").style.display = "none"; document.querySelector("#win_pannel").style.display = "none";
document.querySelector(".niveau").innerHTML = niveauActuel; document.querySelector(".niveau").innerHTML = niveauActuel;

Loading…
Cancel
Save