diff --git a/src/algo.js b/src/algo.js new file mode 100644 index 0000000..c4e8740 --- /dev/null +++ b/src/algo.js @@ -0,0 +1,112 @@ +// Pseudo code +// +/* + * function checkReslt(array ) + * { + * new array> matrice = vide + * + * forEach(array: value) + * { + * matrice.add(value.getAttrib) + * } + * Check all length of matrice + * for(i = 0; i tab + * for (j=0; j { + attributesMatrix.push(element.getAttributes()); + }); + // Idéalement check si toute les listes d'attributs sont de même taille + for(let i = 0; i < attributesMatrix[0].length; i++) { + let listAttributes = [] + for(let j = 0; j < attributesMatrix.length; j++) { + listAttributes.push(attributesMatrix[j][i]); + } + if(!checkAttributes(listAttributes)){ + return false; + } + } + return true; +} + + +function checkAttributes(attributes){ + let orderingMethod = "null"; // Can only take ["null", "same", "different"] + let boolLoop = true; + attributes.forEach((value, index) => { + if(index !== attributes.length) + { + for (let i = index+1; i < attributes.length; i++) + { + if(attributes[i] === value) + { + if(orderingMethod === "null" || orderingMethod === "same") + { + orderingMethod = "same"; + } + else + { + boolLoop = false; + } + } + else + { + if(orderingMethod === "null" || orderingMethod === "different") + { + orderingMethod = "different" + } + else + { + boolLoop = false + } + } + + } + } + }); + return boolLoop === true; +} diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..b32303c --- /dev/null +++ b/src/index.html @@ -0,0 +1,20 @@ + + + + + + My awesome blog + + + +

My awesome blog

+ + + + + + + + \ No newline at end of file