From 76034be507dd8e516b2a4497dd3e7eca59f16fd6 Mon Sep 17 00:00:00 2001 From: readhame Date: Thu, 9 Jul 2020 18:48:23 +0200 Subject: [PATCH] compteur 3x3 3x4 --- HyperSet/.idea/workspace.xml | 1 + HyperSet/vues/css/style.css | 68 ++++++- HyperSet/vues/js/set.js | 367 ++++++++++++++++++++++++++++++++++- 3 files changed, 423 insertions(+), 13 deletions(-) diff --git a/HyperSet/.idea/workspace.xml b/HyperSet/.idea/workspace.xml index 3d00627..22e9adf 100644 --- a/HyperSet/.idea/workspace.xml +++ b/HyperSet/.idea/workspace.xml @@ -113,6 +113,7 @@ + diff --git a/HyperSet/vues/css/style.css b/HyperSet/vues/css/style.css index f681a90..6eba14d 100644 --- a/HyperSet/vues/css/style.css +++ b/HyperSet/vues/css/style.css @@ -71,10 +71,10 @@ h1 { } .game-board1 { - margin-top: -5%; + margin-top: -4%; height: 800px; - width: 800px; - margin-left: 38%; + width: 700px; + margin-left: 40%; transform: rotate(90deg); } @@ -784,4 +784,66 @@ radial-gradient(#fafafa 10%, transparent 10%); + + +.zigzag.solid{ + border: 8px double black; +} + +.zigzag.quadrillage{ + border: 8px double black; +} +.zigzag.stripped{ + border: 8px double black; +} + +.zigzag.green.open{ + border: 8px double green; +} +.zigzag.red.open{ + border: 8px double red; +} +.zigzag.purple.open{ + border: 8px double purple; +} +.zigzag.lightblue.open{ + border: 8px double lightblue; +} + +.zigzag.yellow.open{ + border: 8px double saddlebrown; +} + + + + +.hachure.solid{ + border: 6px ridge #696969; +} + +.hachure.quadrillage{ + border: 6px ridge #696969; +} +.hachure.stripped{ + border: 6px ridge #696969; +} + +.hachure.green.open{ + border: 6px ridge green; +} +.hachure.red.open{ + border: 6px ridge red; +} +.hachure.purple.open{ + border: 6px ridge purple; +} +.hachure.lightblue.open{ + border: 6px ridge #6495ED; +} + +.hachure.yellow.open{ + border: 6px ridge saddlebrown; +} + + /*solution pour avoir l'image en rainure ou vide a voir dans le css*/ \ No newline at end of file diff --git a/HyperSet/vues/js/set.js b/HyperSet/vues/js/set.js index 9349234..9a7203f 100644 --- a/HyperSet/vues/js/set.js +++ b/HyperSet/vues/js/set.js @@ -3,7 +3,7 @@ var Game = { cards: [], selected: [], score: 0, - set: 1, + set: 0, $board: $('[data-display="game-board"]'), $score: $('[data-display="score"]'), $nbSets: $('[data-display="nbSets"]'), @@ -125,6 +125,7 @@ var Game = { success: function (data) { self.cards = data; self.existingSet(); + self.existingSetT(); self.displayCards.call(self); self.setCardListeners(); //self.setPageListeners(); @@ -138,8 +139,8 @@ var Game = { dataType: 'json', success: function (data) { self.cards1 = data; - //self.existingSet1(); self.displayCards1.call(self); + self.existingSet1(); self.setCardListeners1(); //self.setPageListeners1(); @@ -192,6 +193,7 @@ var Game = { success: function (data) { self.cards0 = data; self.displayCards0.call(self); + self.existingSet0(); self.setCardListeners0(); //self.setPageListeners0(); } @@ -653,7 +655,7 @@ var Game = { // PARLER SUR CET ALGO SUR LE RAPPORT - /* + existingSet: function() { var colors = []; @@ -709,15 +711,15 @@ var Game = { } } } + console.log('ah' + self.set); this.$nbSets.html(self.set); - },*/ + }, - existingSet: function() { + existingSetT: function() { var colors1 = []; var shapes1 =[]; var fills1= []; var numbers1= []; - var valid; var self = this; var cartes = self.cards; var cartes1 = cartes; @@ -726,14 +728,13 @@ var Game = { var carte1; var carte2; - var carte3 = []; - var colors2 = []; var shapes2 =[]; var fills2= []; var numbers2= []; var i, j, a; + var test = 0; var colorsall= $.map(this.cards, function(el) { return el.color;}); var shapesall = $.map(this.cards, function(el) { return el.shape; }); var fillsall= $.map(this.cards,function(el) { return el.fill; }); @@ -872,7 +873,9 @@ var Game = { if(colors2[0] === colorsall[a]){ if(fills2[0] === fillsall[a]) { if(numbers2[0] === numbersall[a]){ - self.set = self.set+1; + test = test + 1; + //self.set = self.set+1; + //console.log(shapes2,colors2,fills2,numbers2); } } @@ -884,13 +887,357 @@ var Game = { } } + console.log(test); - this.$nbSets.html(self.set); + //this.$nbSets.html(self.set); + }, + + existingSet0: function() { + var colors1 = []; + var shapes1 =[]; + var numbers1= []; + var self = this; + var cartes = self.cards0; + var cartes1 = cartes; + + + var carte1; + var carte2; + + var colors2 = []; + var shapes2 =[]; + var numbers2= []; + var i, j, a; + + var colorsall= $.map(this.cards0, function(el) { return el.color;}); + var shapesall = $.map(this.cards0, function(el) { return el.shape; }); + var numbersall = $.map(this.cards0, function(el) { return el.number;}); + + + for(i=0; i