Merge branch 'master' into RaphouBranche
continuous-integration/drone/push Build is passing Details

pull/73/head
Raphael LACOTE 2 years ago
commit c1b57e318f

@ -19,7 +19,8 @@
<script src="../Model/Factory.js"></script>
<script src="../Model/Deck.js"></script>
<script src="../../test/testsIsHyperset.js"></script>
<script src="main.js"></script>
<script src="../../test/testsNumberHyperset.js"></script>
<!--<script src="main.js"></script>-->
</body>
</html>

@ -152,33 +152,33 @@ function trouveElements(attributsCartes) {
let x;
tabColor.forEach(element => {
TAB_COLOR.forEach(element => {
if (element == attributsCartes[0]) {
x = createElements(attributsCartes, tabColor);
x = createElements(attributsCartes, TAB_COLOR);
}
});
tabNumber.forEach(element => {
TAB_NUMBER.forEach(element => {
if (element == attributsCartes[0]) {
x = createElements(attributsCartes, tabNumber);
x = createElements(attributsCartes, TAB_NUMBER);
}
});
tabShape.forEach(element => {
TAB_SHAPE.forEach(element => {
if (element == attributsCartes[0]) {
x = createElements(attributsCartes, tabShape);
x = createElements(attributsCartes, TAB_SHAPE);
}
});
tabFilling.forEach(element => {
TAB_FILLING.forEach(element => {
if (element == attributsCartes[0]) {
x = createElements(attributsCartes, tabFilling);
x = createElements(attributsCartes, TAB_FILLING);
}
});
tabOutline.forEach(element => {
TAB_OUTLINE.forEach(element => {
if (element == attributsCartes[0]) {
x = createElements(attributsCartes, tabOutline);
x = createElements(attributsCartes, TAB_OUTLINE);
}
});
@ -191,6 +191,7 @@ function createCard(cards) {
let carteFinale = [];
let listeInter = [];
cards.forEach(element => {
attributesMatrix.push(element.getAttributes());
});
@ -201,6 +202,7 @@ function createCard(cards) {
listeInter.push(element[i]);
});
//S'ils sont tous égaux
if (listeInter.every(element => element === listeInter[0])) {
l = []
@ -218,8 +220,6 @@ function createCard(cards) {
}
}
}
console.log(carteFinale);
return carteFinale;
}
@ -244,3 +244,46 @@ function isHyperset(cardsLeft, cardsRight) {
}
return true;
}
function numberOfHyperset2(deck) {
let res = 0
for (i = 0; i < deck.length - 3; i++) {
for (j = i + 1; j < deck.length - 2; j++) {
for (k = j + 1; k < deck.length - 1; k++) {
for (lapin = k + 1; lapin < deck.length; lapin++) {
console.log(" i,j,k,l :", i, j, k, lapin)
if (isHyperset([deck[i], deck[j]], [deck[k], deck[lapin]])) {
console.log(deck[i],deck[j],deck[k],deck[lapin])
res += 1
}
}
}
}
}
return res
}
function numberOfHyperset3(deck) {
let res = 0
for (i = 0; i < deck.length - 5; i = i + 1) {
for (j = i + 1; j < deck.length - 4; j = j + 1) {
for (k = j + 1; k < deck.length - 3; k = k + 1) {
for (lolita = k + 1; lolita < deck.length - 2; lolita = lolita + 1) {
for (m = lolita + 1; m < deck.length - 1; m = m + 1) {
for (n = m + 1; n < deck.length; n = n + 1) {
//console.log(i, j, k, lolita, m, n)
if (isHyperset([deck[i], deck[j], deck[k]], [deck[lolita], deck[m], deck[n]])) {
res += 1
}
}
}
}
}
}
}
return res
}

@ -1,8 +1,8 @@
let card1 = new Card({'color':'red', 'number':3, 'shape':'wave','filling':'full'});
let card1 = new Card({ 'color': 'red', 'number': 3, 'shape':'squiggle','filling':'full'});
let card2 = new Card({'color':'red', 'number':3, 'shape':'oval','filling':'empty'});
let card3 = new Card({'color':'blue', 'number':2, 'shape':'oval', 'fillin':'full'});
let card4 = new Card({'color':'green', 'number':1, 'shape':'wave', 'fillin':'pointed'});
let card5 = new Card({'color':'green', 'number':1, 'shape':'wave', 'fillin':'full'});
let card4 = new Card({ 'color': 'green', 'number': 1, 'shape':'squiggle', 'fillin':'pointed'});
let card5 = new Card({ 'color': 'green', 'number': 1, 'shape':'squiggle', 'fillin':'full'});
deckA = [];
deckB = [];
deckC = [];
@ -14,16 +14,16 @@ deckC.push(card3, card5);
console.assert(isHyperset(deckA, deckB) == true);
console.assert(isHyperset(deckA, deckC) == false);
let BcardG1 = new Card({'color':'red', 'number':4, 'shape':'wave','filling':'empty','outline':'continuous'});
let BcardG2 = new Card({'color':'red', 'number':3, 'shape':'wave','filling':'full','outline':'continuous'});
let BcardG3 = new Card({'color':'red', 'number':2, 'shape':'wave','filling':'squared','outline':'continuous'});
let BcardG4 = new Card({'color':'red', 'number':1, 'shape':'wave','filling':'pointed','outline':'continuous'});
let BcardG1 = new Card({ 'color': 'red', 'number': 4, 'shape':'diamond','filling':'empty','outline':'continuous'});
let BcardG2 = new Card({ 'color': 'red', 'number': 3, 'shape':'squiggle','filling':'full','outline':'continuous'});
let BcardG3 = new Card({ 'color': 'red', 'number': 2, 'shape':'star','filling':'squared','outline':'continuous'});
let BcardG4 = new Card({ 'color': 'red', 'number': 1, 'shape':'triangle','filling':'pointed','outline':'continuous'});
let BcardD1 = new Card({'color':'green', 'number':3, 'shape':'oval','filling':'pointed','outline':'cloudy'});
let BcardD2 = new Card({'color':'blue', 'number':2, 'shape':'oval','filling':'squared','outline':'sharpy'});
let BcardD3 = new Card({'color':'purple', 'number':4, 'shape':'oval','filling':'full','outline':'hyphen'});
let BcardD4 = new Card({'color':'orange', 'number':1, 'shape':'oval','filling':'empty','outline':'dotted'});
let BcardD5 = new Card({'color':'purple', 'number':4, 'shape':'oval','filling':'stripped','outline':'hyphen'});
let BcardD1 = new Card({'color':'green', 'number':3, 'shape':'oval','filling':'pointed','outline':'dot'});
let BcardD2 = new Card({'color':'blue', 'number':2, 'shape':'oval','filling':'squared','outline':'rect'});
let BcardD3 = new Card({'color':'purple', 'number':4, 'shape':'oval','filling':'full','outline':'spade'});
let BcardD4 = new Card({'color':'orange', 'number':1, 'shape':'oval','filling':'empty','outline':'sharp'});
let BcardD5 = new Card({'color':'purple', 'number':4, 'shape':'oval','filling':'stripped','outline':'spade'});
BdeckA = [];

@ -0,0 +1,9 @@
// CREATE DECK
let deck = new Deck([0, 1, 2, 3], 4);
// CHECK HYPERSET
console.log(deck.outputCards)
console.log(numberOfHyperset3(deck.outputCards))
Loading…
Cancel
Save