edit const
continuous-integration/drone/push Build is passing Details

pull/66/head
Bastien JACQUELIN 2 years ago
parent 515d42739e
commit bb8a27017b

@ -1,8 +1,8 @@
const TAB_COLOR = ['red', 'purple', 'green', 'blue', 'orange']; const TAB_COLOR = ['red', 'purple', 'green', 'blue', 'orange'];
const TAB_NUMBER = [1, 2, 3, 4, 5]; const TAB_NUMBER = [1, 2, 3, 4, 5];
const TAB_SHAPE = ['diamond', 'oval', 'squiggle', 'star', 'triangle']; const TAB_SHAPE = ['diamond', 'oval', 'squiggle', 'star', 'triangle'];
const TAB_FILLING = ['empty', 'stripped', 'fullO', 'pointed', 'squared']; const TAB_FILLING = ['empty', 'stripped', 'full', 'pointed', 'squared'];
const TAB_OUTLINE = ['full', 'dot', 'rect', 'spade', 'sharp']; const TAB_OUTLINE = ['continuous', 'dot', 'rect', 'spade', 'sharp'];
const ATTRIBUTES = [TAB_COLOR, TAB_NUMBER, TAB_SHAPE, TAB_FILLING, TAB_OUTLINE]; const ATTRIBUTES = [TAB_COLOR, TAB_NUMBER, TAB_SHAPE, TAB_FILLING, TAB_OUTLINE];
const IDX_ATTRIBUTES = ["color", "number", "shape", "filling", "outline"]; const IDX_ATTRIBUTES = ["color", "number", "shape", "filling", "outline"];

@ -32,21 +32,27 @@ class Deck {
console.log("PLUS DE CARTES"); console.log("PLUS DE CARTES");
return; return;
} }
else {
let nbSets = setsCounter(this.outputCards, this.nbCards);
if(this.outputCards.length>=12 && nbSets!=0){
return
}
else{ else{
for (let i = 0; i < nbCards; i++) { for (let i = 0; i < nbCards; i++) {
const rand = this.getRandCard(); const rand = this.getRandCard();
this.outputCards.push(this.remainingCards[rand]); this.outputCards.push(this.remainingCards[rand]);
this.remainingCards.splice(rand, 1); this.remainingCards.splice(rand, 1);
} }
let nbSets = setsCounter(this.outputCards, this.nbCards); nbSets = setsCounter(this.outputCards, this.nbCards);
console.log("nbSets", nbSets); console.log("nbSets", nbSets);
console.log("outputCards.length", this.outputCards.length); // console.log("outputCards.length", this.outputCards.length);
console.log("remainingCards.length", this.remainingCards.length); // console.log("remainingCards.length", this.remainingCards.length);
if (nbSets == 0) { if (nbSets == 0) {
this.createDeck(this.nbCards) this.createDeck(this.nbCards)
} }
} }
} }
}
/** /**
* *

Loading…
Cancel
Save