From 128d641657de85cfac8644647241be886dbd870a Mon Sep 17 00:00:00 2001 From: "remi.arnal" Date: Sun, 2 Apr 2023 13:18:19 +0200 Subject: [PATCH 1/4] tweaks + bug --- src/Model/Const.js | 4 ++-- src/Model/card-to-html.js | 15 +++++++-------- views/cards-test.html | 17 ++++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/Model/Const.js b/src/Model/Const.js index 858eec3..200c05d 100755 --- a/src/Model/Const.js +++ b/src/Model/Const.js @@ -15,8 +15,8 @@ const SHAPE_PATH = { }; const OUTLINE_SPEC = { - full: {}, - dot: { "stroke-dasharray": "1 20", "stroke-linecap": "round" }, + continuous: {}, + dot: { "stroke-dasharray": "1 25", "stroke-linecap": "round" }, rect: { "stroke-dasharray": 70 }, spade: { "stroke-dasharray": "10 15", "stroke-width": 40 }, sharp: {} diff --git a/src/Model/card-to-html.js b/src/Model/card-to-html.js index e5bbb1f..fdf6b76 100755 --- a/src/Model/card-to-html.js +++ b/src/Model/card-to-html.js @@ -10,6 +10,10 @@ class CardToHtml { svg.setAttribute('height','160'); svg.setAttribute('width','80'); svg.setAttribute('viewBox','0 0 200 400'); + + if(card.attributes['number'] == undefined){ + card.attributes['number'] = 1; + } // Create paths + add to svg for(let j = 0; j < 2; j++) { @@ -31,14 +35,9 @@ class CardToHtml { // The way to create svg element (differs from html element) const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); - if(shape === null) shape = 'oval'; - if(color === null) color = '000000'; - if(filling === null) filling = 'fill'; - - // console.log("shape: " + shape); - // console.log("color: " + color); - // console.log("filling: " + filling); - // console.log("outline: " + outline); + if(shape === undefined) shape = 'oval'; + if(color === undefined) color = 'black'; + if(filling === undefined) filling = 'none'; // Add lots of attributes path.setAttribute("d",SHAPE_PATH[shape]); diff --git a/views/cards-test.html b/views/cards-test.html index 57c7f1c..32884c0 100755 --- a/views/cards-test.html +++ b/views/cards-test.html @@ -122,17 +122,16 @@ // const c2 = new Card({shape: 'oval', color: '008000', number: 2, filling: 'full', outline: null}) // const c3 = new Card({shape: 'oval', color: '800080', number: 3, filling: 'full', outline: null}) - const c1 = new Card({shape: 'diamond', color: 'green', number: 3, filling: 'empty', outline: null}) - const c2 = new Card({shape: 'squiggle', color: 'blue', number: 1, filling: 'stripe', outline: null}) - const c3 = new Card({shape: 'squiggle', color: 'blue', number: 2, filling: 'stripe', outline: null}) - const c4 = new Card({shape: 'diamond', color: 'green', number: 2, filling: 'empty', outline: null}) - const c5 = new Card({shape: 'oval', color: 'red', number: 2, filling: 'full', outline: null}) + // const c1 = new Card({shape: 'diamond', color: 'green', number: 3, filling: 'empty', outline: null}) + // const c2 = new Card({shape: 'squiggle', color: 'blue', number: 1, filling: 'stripe', outline: null}) + // const c3 = new Card({shape: 'squiggle', color: 'blue', number: 2, filling: 'stripe', outline: null}) + // const c4 = new Card({shape: 'diamond', color: 'green', number: 2, filling: 'empty', outline: null}) + // const c5 = new Card({shape: 'oval', color: 'red', number: 2, filling: 'full', outline: null}) + // const c6 = new Card({shape: 'oval', color: 'red', number: 1, filling: 'dot', outline: null}) + const c1 = new Card({shape: 'diamond',color: 'orange' ,filling: 'grid', outline: 'dot'}) + CardToHtml.create(c1); - CardToHtml.create(c2); - CardToHtml.create(c3); - CardToHtml.create(c4); - CardToHtml.create(c5); \ No newline at end of file From 430632932b2284d0c7d9e85efde40b7248691db2 Mon Sep 17 00:00:00 2001 From: "remi.arnal" Date: Sun, 2 Apr 2023 14:33:13 +0200 Subject: [PATCH 2/4] =?UTF-8?q?css=20to=20be=20responsive=20(a=20moiti?= =?UTF-8?q?=C3=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/card.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/styles/card.css b/styles/card.css index 546028d..70360c6 100755 --- a/styles/card.css +++ b/styles/card.css @@ -3,8 +3,8 @@ flex-direction: row; justify-content: center; align-items: center; - height: 8rem; - min-width: 18rem; + height: 12vh; + min-width: 14vw; padding: 1.5em; margin: 1.2rem; /* for better display */ border: 0.3em solid black; @@ -14,7 +14,7 @@ svg { height: 12vh; - width: 6vh; + width: 3vw; } .item { From 7fe0e5f7f7cd3572c93370cb9a23603661b2e1dd Mon Sep 17 00:00:00 2001 From: "remi.arnal" Date: Sun, 2 Apr 2023 15:03:28 +0200 Subject: [PATCH 3/4] card horizontal -> vertical --- styles/card.css | 14 +++++++++----- views/deck-module.js | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/styles/card.css b/styles/card.css index 70360c6..0c7a614 100755 --- a/styles/card.css +++ b/styles/card.css @@ -1,10 +1,10 @@ .card { display: flex; - flex-direction: row; + flex-direction: column; justify-content: center; align-items: center; - height: 12vh; - min-width: 14vw; + width: 6vw; + min-height: 26vh; padding: 1.5em; margin: 1.2rem; /* for better display */ border: 0.3em solid black; @@ -12,13 +12,17 @@ background-color: white; } +.card:hover { + cursor: pointer; +} + svg { - height: 12vh; + rotate: 90deg; + height: 7vh; width: 3vw; } .item { - margin: 1rem; } #main { diff --git a/views/deck-module.js b/views/deck-module.js index d93e296..566b44d 100644 --- a/views/deck-module.js +++ b/views/deck-module.js @@ -65,7 +65,7 @@ export default{

Players: {{connected}}

-
+
From 54d319ef6c84d6d3b8e639bbcc79d4d15e4972b4 Mon Sep 17 00:00:00 2001 From: Aurian JAULT Date: Sun, 2 Apr 2023 15:30:17 +0200 Subject: [PATCH 4/4] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/algo.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/algo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algo.js b/src/algo.js index bcc7e7b..dbb853c 100755 --- a/src/algo.js +++ b/src/algo.js @@ -82,7 +82,7 @@ function numberOfSets4(deck){ for(j = i+1 ; j < deck.length - 2; j++){ for(k = j+1 ; k < deck.length - 1 ; k++){ for(l = k + 1 ; l < deck.length;l++){ - if(isSet([deck[i],deck[j],deck[k]])){ + if(isSet([deck[i],deck[j],deck[k],deck[l]])){ //console.log(deck[i],deck[j],deck[k],deck[l]) res += 1 } @@ -100,7 +100,7 @@ function numberOfSets5(deck){ for(k = j+1 ; k < deck.length - 2 ; k++){ for(l = k + 1 ; l < deck.length - 1;l++){ for(m = l + 1; m