diff --git a/.drone.yml b/.drone.yml
index a8d87da..d365e34 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -27,5 +27,14 @@ steps:
CONTAINERNAME: hyperset
COMMAND: create
OVERWRITE: true
- ADMINS: aurian.jault
- depends_on : [hyperset-build]
\ No newline at end of file
+ ADMINS: aurianjault,raphaellacote,bastienjacquelin,remiarnal
+ depends_on : [hyperset-build]
+
+ - name: code-analysis
+ image: sonarsource/sonar-scanner-cli
+ environment:
+ SONAR_TOKEN:
+ from_secret: SONAR_TOKEN
+ commands:
+ - sonar-scanner -Dsonar.projectKey=hyperset -Dsonar.sources=. -Dsonar.host.url=https://codefirst.iut.uca.fr/sonar -Dsonar.login=$${SONAR_TOKEN}
+ depends_on: [ hyperset-build ]
\ No newline at end of file
diff --git a/src/Console/Console.html b/src/Console/Console.html
deleted file mode 100644
index 9ba88b8..0000000
--- a/src/Console/Console.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
- Console
-
-
-
- Console - test
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Console/main.js b/src/Console/main.js
index 2668f88..0d00811 100644
--- a/src/Console/main.js
+++ b/src/Console/main.js
@@ -30,8 +30,10 @@ try {
console.groupEnd();
+// CREATE DECK
+
console.group('Deck');
-let deck = new Deck([0,1,2,3]);
+let deck = new Deck([0,1,2,3],3);
console.log(`All cards : ${deck.allCards.length}`);
//Display all cards
console.log(`All cards display`);
@@ -45,14 +47,19 @@ console.log(`remaining cards : ${deck.remainingCards.length}`)
// console.log(e.getAttributes());
// });
console.log(`size output ${deck.outputCards.length}`);
-console.log(`Output cards`);
+console.group('Output cards');
deck.outputCards.forEach(e => {
console.log(e.getAttributes());
});
+console.groupEnd();
console.log(`set already made ${deck.setMade}`);
-// deck.setMade.forEach(e => {
-// console.log(e.color,e.number,e.shape,e.filling);
-// });
+deck.setMade.forEach(e => {
+ console.log(e.color,e.number,e.shape,e.filling);
+ });
+
+
+// CHECK SET
+console.log("CHECKING SET")
console.log("Card to remove: ")
console.log(deck.outputCards[0].getAttributes(),deck.outputCards[1].getAttributes(),deck.outputCards[2].getAttributes())
@@ -60,18 +67,22 @@ let customCard=[deck.outputCards[0],deck.outputCards[1],deck.outputCards[2]];
deck.checkSet(customCard);
console.log(`remaining cards : ${deck.remainingCards.length}`)
console.log(`All cards : ${deck.allCards.length}`)
-
-console.log(`remaining cards : ${deck.remainingCards.length}`)
// deck.remainingCards.forEach(e => {
// console.log(e.getAttributes());
// });
-
console.log(`size output ${deck.outputCards.length}`);
-console.log(`Output cards`);
+console.group('Output cards');
deck.outputCards.forEach(e => {
console.log(e.getAttributes());
});
+console.groupEnd();
+console.group('set made');
+console.log(`set already made : ${deck.setMade.length}`);
+deck.setMade.forEach(e => {
+ console.log(e.color,e.number,e.shape,e.filling);
+ });
+ console.groupEnd();
//let deck5 = new Deck([0,1,2,3,4]);
//console.log(`All cards with 5 attributes size ${deck5.allCards.length}`);
diff --git a/src/Model/Deck.js b/src/Model/Deck.js
index 57e9d23..03fe67f 100644
--- a/src/Model/Deck.js
+++ b/src/Model/Deck.js
@@ -2,21 +2,24 @@ class Deck{
/**
*
* @param {*} attributes : array with the attributes index for the cards
+ * @author Bastien Jacquelin
*/
- constructor(attributes){
+ constructor(attributes,nbCards){
//console.log(attributes);
this.allCards=this.createCards(attributes);// All the cards in the game
this.remainingCards=[]
+ this.nbCards=nbCards;
this.remainingCards=this.remainingCards.concat(this.allCards);// cards in the stack
this.outputCards=[];// 12 cards lay on the table
this.setMade=[];// array with all the set already mades (array of set)
- this.createDeck();
+ this.createDeck(12);
}
/**
- * @brief creation of the deck : call factory to create the good cards
+ * @brief creation of the deck : 12 cards lay in front of the player
+ * @author Bastien Jacquelin
*/
- createDeck(){
- for (let i=0; i<12; i++){
+ createDeck(nbCards){
+ for (let i=0; i {
- this.removeFromoutputCards(e);
- });
+ this.removeFromoutputCards(selectedCards);
}
}
/**
- *
- * @param {*} selectedCards wehn a set is made, need to remove the card from the array remainingCards
+ * @brief when a set is made, need to remove the card from the array remainingCards
+ * @param {*} selectedCards cards which need to be removed from the outputcards
+ * @author Bastien Jacquelin
*/
removeFromoutputCards(selectedCards){//better check of card type more opti
let set=[];
- for(let i=0; i {
+ for(let i=0; i)
- * {
- * 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());
});
@@ -110,3 +58,72 @@ function checkAttributes(attributes){
});
return boolLoop === true;
}
+
+// The digit refere to the number of cards required to make a set
+//
+function numberOfSets3(deck){
+ let res = 0
+ for(i=0;i