From 66498cf2274b0561d2ba15fd2d7a605a6e4cafbe Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Tue, 7 Mar 2023 17:24:37 +0100 Subject: [PATCH 1/6] Les tests remarchent --- src/algo.js | 24 ++++++++++++------------ test/testsIsHyperset.js | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/algo.js b/src/algo.js index e4c38c8..6db803d 100755 --- a/src/algo.js +++ b/src/algo.js @@ -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; } diff --git a/test/testsIsHyperset.js b/test/testsIsHyperset.js index 664ddcc..60f0202 100755 --- a/test/testsIsHyperset.js +++ b/test/testsIsHyperset.js @@ -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 = []; From b35f4b15dd5eb2e2beae46249552a82e8bc77e09 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Wed, 8 Mar 2023 12:21:30 +0100 Subject: [PATCH 2/6] Ca marche !!! Vive les pingouins --- src/Console/Console.html | 3 ++- src/algo.js | 43 +++++++++++++++++++++++++++++++++++++ test/testsNumberHyperset.js | 9 ++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 test/testsNumberHyperset.js diff --git a/src/Console/Console.html b/src/Console/Console.html index 991d7c0..c289909 100755 --- a/src/Console/Console.html +++ b/src/Console/Console.html @@ -19,7 +19,8 @@ - + + \ No newline at end of file diff --git a/src/algo.js b/src/algo.js index 6db803d..bcc7e7b 100755 --- a/src/algo.js +++ b/src/algo.js @@ -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 + +} + diff --git a/test/testsNumberHyperset.js b/test/testsNumberHyperset.js new file mode 100644 index 0000000..4483516 --- /dev/null +++ b/test/testsNumberHyperset.js @@ -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)) From e3e5d1320ffa3979194754e06f365002126bd6f7 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Mon, 13 Mar 2023 11:03:36 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20vue=20tutorial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/tutorial.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 views/tutorial.html diff --git a/views/tutorial.html b/views/tutorial.html new file mode 100644 index 0000000..377956f --- /dev/null +++ b/views/tutorial.html @@ -0,0 +1,24 @@ + + + + + + + Game + + + + + + +
+ +
+ + \ No newline at end of file From 73497d3c5e6c3ff671d62b87472dfc499f2f72bb Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Mon, 13 Mar 2023 16:33:26 +0100 Subject: [PATCH 4/6] Page tutorial avec image --- index.html | 9 ++++++--- resources/logo.png | Bin 0 -> 16928 bytes styles/index.css | 26 +++++++++++++++++++++++++- views/navBar.html | 20 ++++++++++++++++++++ views/tutorial.html | 42 +++++++++++++++++++++++++++++++++--------- 5 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 resources/logo.png create mode 100644 views/navBar.html diff --git a/index.html b/index.html index 04d117e..a5a5084 100755 --- a/index.html +++ b/index.html @@ -10,6 +10,9 @@ + + +