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"];

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

Loading…
Cancel
Save