|
|
|
@ -111,7 +111,7 @@ function buttonSpin(button, type) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.querySelector("#colonne_number_setup_global_gen").addEventListener('input', (event) => {
|
|
|
|
|
if (parseInt(document.querySelector("#colonne_number_setup_global_gen").value) <= 1) document.querySelector("#colonne_number_setup_global_gen").value = 2;
|
|
|
|
|
if (parseInt(document.querySelector("#colonne_number_setup_global_gen").value) <= 0) document.querySelector("#colonne_number_setup_global_gen").value = 1;
|
|
|
|
|
calcul();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -143,9 +143,53 @@ function calcul(launch) {
|
|
|
|
|
}
|
|
|
|
|
document.querySelector("#colonnes_live").innerHTML = col + " | nombre de colonne : " + col.length + " | nombre total de portes : " + number_const;
|
|
|
|
|
|
|
|
|
|
var matchs = [];
|
|
|
|
|
var fork = [];
|
|
|
|
|
var error = null;
|
|
|
|
|
|
|
|
|
|
document.querySelectorAll(".div_gen_col_fork").forEach(function (element) {
|
|
|
|
|
element.childNodes[0].innerHTML = "Ajouter un fork pour la colonne " + element.childNodes[1].value + " qui se divise en " + element.childNodes[2].value;
|
|
|
|
|
matchs.push([(parseInt(element.childNodes[1].value) + 1), parseInt(element.childNodes[2].value)]);
|
|
|
|
|
fork.push([parseInt(element.childNodes[1].value), parseInt(element.childNodes[2].value)]);
|
|
|
|
|
if (parseInt(element.childNodes[1].value) < 1 || parseInt(element.childNodes[1].value) > col.length) {
|
|
|
|
|
error = "Problème sur le numéro de colonne";
|
|
|
|
|
element.childNodes[1].style.borderColor = "red";
|
|
|
|
|
} else {
|
|
|
|
|
element.childNodes[1].style.borderColor = "white";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (error !== null) ErrorMessage(error);
|
|
|
|
|
if (launch !== undefined && launch !== null && launch === true) {
|
|
|
|
|
generate2(col);
|
|
|
|
|
generate2(col, matchs, fork);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addGenForkInput() {
|
|
|
|
|
var div = document.createElement("div");
|
|
|
|
|
div.classList = "div_gen_col_fork";
|
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
span.innerHTML = "Ajouter un fork pour la colonne 1 qui se divise en 2";
|
|
|
|
|
div.appendChild(span);
|
|
|
|
|
var input = document.createElement("input");
|
|
|
|
|
input.addEventListener('input', (event) => {
|
|
|
|
|
calcul();
|
|
|
|
|
});
|
|
|
|
|
input.value = 1;
|
|
|
|
|
div.append(input);
|
|
|
|
|
input = document.createElement("input");
|
|
|
|
|
input.addEventListener('input', (event) => {
|
|
|
|
|
calcul();
|
|
|
|
|
});
|
|
|
|
|
input.value = 2;
|
|
|
|
|
div.append(input);
|
|
|
|
|
var i = document.createElement("i");
|
|
|
|
|
i.className = "fa fa-trash";
|
|
|
|
|
i.onclick = function () {
|
|
|
|
|
this.parentElement.remove();
|
|
|
|
|
}
|
|
|
|
|
div.append(i);
|
|
|
|
|
document.querySelector("#gen_fork_div").appendChild(div);
|
|
|
|
|
calcul();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function tuto(niveau) {
|
|
|
|
@ -235,7 +279,7 @@ function createGameOne(niveau) {
|
|
|
|
|
numberColonne2 = 1;
|
|
|
|
|
timeEnd = 20;
|
|
|
|
|
break;
|
|
|
|
|
//Fin premiere serie
|
|
|
|
|
//Fin premiere serie
|
|
|
|
|
case 5:
|
|
|
|
|
firstTime.push("inv");
|
|
|
|
|
isNotAllowed = true;
|
|
|
|
@ -354,31 +398,26 @@ function createGameOne(niveau) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function generate2(col) {
|
|
|
|
|
function generate2(col, matchs, fork) {
|
|
|
|
|
hideDiv(document.querySelector('#TestNouveauGenerateur'));
|
|
|
|
|
showDiv(document.querySelector('#playPage'));
|
|
|
|
|
resetAllTabs(false);
|
|
|
|
|
var matchs = [
|
|
|
|
|
[2, 2]
|
|
|
|
|
];
|
|
|
|
|
var fork = [
|
|
|
|
|
[1, 2]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var numberCol = col.length;
|
|
|
|
|
var numberPerCol = col;
|
|
|
|
|
var numberPerCol = [];
|
|
|
|
|
numberPerColonne = [];
|
|
|
|
|
for (let i = 0; i < col.length; i++) {
|
|
|
|
|
numberPerCol[i] = col[i];
|
|
|
|
|
numberPerColonne[i] = col[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
colonneTot = col.length;
|
|
|
|
|
numberPerColonne = col;
|
|
|
|
|
console.log(numberPerColonne);
|
|
|
|
|
|
|
|
|
|
var compt = new Array();
|
|
|
|
|
var listeSame = [];
|
|
|
|
|
let num = 1;
|
|
|
|
|
|
|
|
|
|
//attribution
|
|
|
|
|
for (let i = numberCol; i > 0; i--) {
|
|
|
|
|
|
|
|
|
|
matchs.forEach(function (element) {
|
|
|
|
|
if (element[0] == i) {
|
|
|
|
|
for (let j = 0; j < element[1]; j++) {
|
|
|
|
@ -528,6 +567,7 @@ function generate2(col) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
initEndGame();
|
|
|
|
|
checkAllSortieLogique();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getNumberFork(arr, col) {
|
|
|
|
|