From 4382af5b34f5856f6a5ee8304efe6ba9eac410b1 Mon Sep 17 00:00:00 2001 From: readhame Date: Tue, 21 Jul 2020 17:57:57 +0200 Subject: [PATCH] 4x5 --- HyperSet/.idea/workspace.xml | 7 +- HyperSet/set.php | 4 +- HyperSet/vues/css/style.css | 12 + HyperSet/vues/homePage.html | 8 +- HyperSet/vues/js/set.js | 960 ++++++++++++++++++++++++++++++++++- 5 files changed, 958 insertions(+), 33 deletions(-) diff --git a/HyperSet/.idea/workspace.xml b/HyperSet/.idea/workspace.xml index 70c81b2..8bacaa9 100644 --- a/HyperSet/.idea/workspace.xml +++ b/HyperSet/.idea/workspace.xml @@ -131,7 +131,8 @@ - + + @@ -175,10 +176,10 @@ - + - + diff --git a/HyperSet/set.php b/HyperSet/set.php index 1bf4dd6..703d015 100644 --- a/HyperSet/set.php +++ b/HyperSet/set.php @@ -31,13 +31,13 @@ if (isset($_GET['action']) && $_GET['action'] == 'deal') { $_SESSION['deck3'] = new Deck($_GET['action']); $_SESSION['game3'] = new Game($_SESSION['deck3']); $game = $_SESSION['game3']; - echo json_encode($game->start(20)); + echo json_encode($game->start(50)); } else if (isset($_GET['action']) && $_GET['action'] == 'deal4') { $_SESSION['deck4'] = new Deck($_GET['action']); $_SESSION['game4'] = new Game($_SESSION['deck4']); $game = $_SESSION['game4']; - echo json_encode($game->start(20)); + echo json_encode($game->start(50)); }else if (isset($_GET['action']) && $_GET['action'] == 'deal0') { $_SESSION['deck0'] = new Deck($_GET['action']); diff --git a/HyperSet/vues/css/style.css b/HyperSet/vues/css/style.css index fac83a3..e577974 100644 --- a/HyperSet/vues/css/style.css +++ b/HyperSet/vues/css/style.css @@ -54,6 +54,18 @@ h1 { position: fixed; } + +.game-board3 { + + margin-left: -15%; + height: 1000px; + width: 1700px; + position: fixed; + +} + + + .game-board2 { margin-top: -1%; margin-left: 17%; diff --git a/HyperSet/vues/homePage.html b/HyperSet/vues/homePage.html index e2a3b1d..38a5c9b 100644 --- a/HyperSet/vues/homePage.html +++ b/HyperSet/vues/homePage.html @@ -126,15 +126,16 @@

Nombre de carte = 5; Nombre de critères = 5

+

Paramètres: 1.Couleur, 2.Forme, 3.Remplissage 4.Bordure 5.Nombre

Sets found: 0

Number of Sets:

-
+
diff --git a/HyperSet/vues/js/set.js b/HyperSet/vues/js/set.js index 1badcb7..6e5b682 100644 --- a/HyperSet/vues/js/set.js +++ b/HyperSet/vues/js/set.js @@ -166,7 +166,7 @@ var Game = { success: function (data) { self.cards3 = data; self.displayCards3.call(self); - //self.existingSet3(); + self.existingSet3(); self.setCardListeners3(); //self.setPageListeners3(); } @@ -394,16 +394,17 @@ var Game = { 'number': card.number }); - var shapeNode = $(""); - shapeNode.addClass('shape ' + card.color + ' ' + card.shape + ' ' + card.fill + ' ' + card.border); + var shapeNode = $("
"); + shapeNode.append(card.color + ' ' + card.shape + ' ' + card.fill + ' ' + card.border + ' '+ card.number); - for (var i = 0; i < card.number; i++) { + /*for (var i = 0; i < card.number; i++) { cardNode.append(shapeNode.clone()); - } + }*/ + cardNode.append(shapeNode); self.$board3.append(cardNode); // display 4 cards per row - if ((index+1) % 4 === 0) { + if ((index+1) % 10 === 0) { self.$board3.append($('
')); } @@ -432,16 +433,18 @@ var Game = { 'number': card.number }); - var shapeNode = $(""); - shapeNode.addClass('shape ' + card.color + ' ' + card.shape + ' ' + card.fill + ' ' + card.border); + var shapeNode = $("
"); + shapeNode.append( card.color + ' ' + card.shape + ' ' + card.fill + ' ' + card.border + ' ' + card.number); - for (var i = 0; i < card.number; i++) { + /*for (var i = 0; i < card.number; i++) { cardNode.append(shapeNode.clone()); - } - self.$board4.append(cardNode); + }*/ + cardNode.append(shapeNode); + + self.$board4.append(cardNode); // display 4 cards per row - if ((index+1) % 4 === 0) { + if ((index+1) %10 === 0) { self.$board4.append($('
')); } @@ -1000,6 +1003,98 @@ var Game = { }, + existingSet3: function() { + var colors1 = []; + var shapes1 =[]; + var fills1= []; + var borders1= []; + var numbers1= []; + var self = this; + var cartes = self.cards3; + var cartes1 = cartes; + var cartes2 = cartes; + + + var carte1, carte3; + var carte2; + var card4 = []; + var tCards = []; + + + var i, j, a, k; + + var colorsall= $.map(this.cards3, function(el) { return el.color;}); + var shapesall = $.map(this.cards3, function(el) { return el.shape; }); + var fillsall= $.map(this.cards3,function(el) { return el.fill; }); + var bordersall= $.map(this.cards3,function(el) { return el.border; }); + var numbersall = $.map(this.cards3, function(el) { return el.number;}); + + + for(i=0; i < cartes.length-2; i++) { + for (j = i + 1; j < cartes1.length - 1; j++) { + for (k = j + 1; k < cartes2.length; k++) { + + carte1 = cartes[i]; + carte2 = cartes1[j]; + carte3 = cartes2[k]; + + tCards[0] = carte1; + tCards[1]= carte2; + tCards[2]= carte3; + + + card4 = this.generateVirtualCard45(tCards); + + colors1.splice(0,1,carte1.color); + colors1.splice(1,1,carte2.color); + colors1.splice(2,1,carte3.color); + colors1.splice(3, 1, card4[0].color); + + shapes1.splice(0,1,carte1.shape); + shapes1.splice(1,1,carte2.shape); + shapes1.splice(2,1,carte3.shape); + shapes1.splice(3, 1, card4[0].shape); + + + fills1.splice(0,1,carte1.fill); + fills1.splice(1,1,carte2.fill); + fills1.splice(2,1,carte3.fill); + fills1.splice(3, 1, card4[0].fill); + + borders1.splice(0,1,carte1.border); + borders1.splice(1,1,carte2.border); + borders1.splice(2,1,carte3.border); + borders1.splice(3, 1, card4[0].border); + + + numbers1.splice(0,1,carte1.number); + numbers1.splice(1,1,carte2.number); + numbers1.splice(2,1,carte3.number); + numbers1.splice(3, 1, card4[0].number); + + + + //if(this.cardInListOfCards44(shapes1[3],colors1[3],fills1[3],numbers1[3] )){} + + for (a = k+1; a < self.cards3.length; a++) { + if (shapes1[3] !== undefined && colors1[3] !== undefined && fills1[3] !== undefined && borders1[3] !== undefined && numbers1[3] !== undefined) { + if (shapes1[3] === shapesall[a] && colors1[3] === colorsall[a] && fills1[3] === fillsall[a] && borders1[3] === bordersall[a] && numbers1[3] === numbersall[a]) { + if (this.isSet4(shapes1) && this.isSet4(colors1) && this.isSet4(fills1) && this.isSet4(borders1) && this.isSet4(numbers1)) { + console.log('Set 4x5 : '); + console.log(shapes1, colors1, fills1, borders1, numbers1); + self.set3 = self.set3 + 1; + } + + } + } + } + } + } + } + console.log('-----------------------------------------------------------------'); + + this.$nbSets3.html(self.set3); + }, /* @@ -1553,10 +1648,10 @@ var Game = { if (shapes1[2] !== undefined && colors1[2] !== undefined && numbers1[2] !== undefined) { if (shapes1[1] !== undefined && colors1[1] !== undefined && numbers1[1] !== undefined) { if(shapes1[1] === shapesall[a] && colors1[1]=== colorsall[a] && numbers1[1] === numbersall[a]){ - console.log('ab'); - console.log(shapes1, colors1, numbers1); - console.log(carte1); - console.log(carte2); + //console.log('ab'); + //console.log(shapes1, colors1, numbers1); + //console.log(carte1); + //console.log(carte2); self.setHS0 = self.setHS0 + 1; } } @@ -1568,10 +1663,10 @@ var Game = { if (shapes2[2] !== undefined && colors2[2] !== undefined && numbers2[2] !== undefined) { if (shapes2[1] !== undefined && colors2[1] !== undefined && numbers2[1] !== undefined) { if(shapes2[1] === shapesall[a] && colors2[1]=== colorsall[a] && numbers2[1] === numbersall[a]){ - console.log('ac'); - console.log(shapes2, colors2, numbers2); - console.log(carte1); - console.log(carte3); + //console.log('ac'); + //console.log(shapes2, colors2, numbers2); + //console.log(carte1); + //console.log(carte3); self.setHS0 = self.setHS0 + 1; } } @@ -1583,10 +1678,10 @@ var Game = { if (shapes3[2] !== undefined && colors3[2] !== undefined && numbers3[2] !== undefined) { if (shapes3[1] !== undefined && colors3[1] !== undefined && numbers3[1] !== undefined) { if(shapes3[1] === shapesall[a] && colors3[1]=== colorsall[a] && numbers3[1] === numbersall[a]){ - console.log('bc'); - console.log(shapes3, colors3, numbers3); - console.log(carte2); - console.log(carte3); + //console.log('bc'); + //console.log(shapes3, colors3, numbers3); + //console.log(carte2); + //console.log(carte3); self.setHS0 = self.setHS0 + 1; } } @@ -1802,7 +1897,285 @@ var Game = { this.$nbSetsHS1.html(self.setHS1); }, + existingHyperSet2: function() { + var colors1 = []; + var shapes1 =[]; + var fills1= []; + var borders1 = []; + var numbers1= []; + var colors2 = []; + var shapes2 =[]; + var fills2= []; + var borders2 = []; + var numbers2= []; + var colors3 = []; + var shapes3 =[]; + var fills3= []; + var borders3 = []; + var numbers3= []; + + var self = this; + var cartes = self.cardsHS2; + var cartes1 = cartes; + var cartes2 = cartes; + var cartes3 = cartes; + var cartes4 = cartes; + + + var carte1, carte3, carte4, carte5; + var carte2; + var card4ABC = []; + var card4ABD = []; + var card4ABE = []; + var card4ACD = []; + var card4ACE = []; + var card4BCD = []; + var card4BCE = []; + var card4CDE = []; + + var cardVirtualABC = []; + var cardVirtualABD = []; + var cardVirtualABE = []; + var cardVirtualACD = []; + var cardVirtualACE = []; + var cardVirtualBCD = []; + var cardVirtualBCE = []; + var cardVirtualCDE = []; + + var tCardsABC = []; + var tCardsABD = []; + var tCardsABE = []; + var tCardsACD = []; + var tCardsACE = []; + var tCardsBCD = []; + var tCardsBCE = []; + var tCardsCDE = []; + + + + var i, j, a,l, m, k; + + var colorsall= $.map(this.cardsHS1, function(el) { return el.color;}); + var shapesall = $.map(this.cardsHS1, function(el) { return el.shape; }); + var fillsall= $.map(this.cardsHS1,function(el) { return el.fill; }); + var bordersall= $.map(this.cardsHS1,function(el) { return el.border; }); + var numbersall = $.map(this.cardsHS1, function(el) { return el.number;}); + + + for(i=0; i < cartes.length-4; i++) { + for (j = i + 1; j < cartes1.length - 3; j++) { + for (k = j + 1; k < cartes2.length-2; k++) { + for (l = k + 1; l < cartes3.length-1; l++) { + for (m = l + 1; m < cartes4.length; m++) { + + + carte1 = cartes[i]; + carte2 = cartes1[j]; + carte3 = cartes2[k]; + carte4 = cartes3[l]; + carte5 = cartes4[m]; + + + tCardsABC[0] = carte1; + tCardsABC[1] = carte2; + tCardsABC[2] = carte3; + + + tCardsABD[0] = carte1; + tCardsABD[1] = carte2; + tCardsABD[2] = carte4; + + tCardsABE[0] = carte1; + tCardsABE[1] = carte2; + tCardsABE[2] = carte5; + + tCardsACD[0] = carte1; + tCardsACD[1] = carte3; + tCardsACD[2] = carte4; + + tCardsACE[0] = carte1; + tCardsACE[1] = carte3; + tCardsACE[2] = carte5; + + tCardsBCD[0] = carte2; + tCardsBCD[1] = carte3; + tCardsBCD[2] = carte4; + + tCardsBCE[0] = carte2; + tCardsBCE[1] = carte3; + tCardsBCE[2] = carte5; + + tCardsCDE[0] = carte3; + tCardsCDE[1] = carte4; + tCardsCDE[2] = carte5; + + cardVirtualABC = this.generateVirtualCard44(tCardsABC); + cardVirtualABD = this.generateVirtualCard44(tCardsABD); + cardVirtualABE = this.generateVirtualCard44(tCardsABE); + cardVirtualACD = this.generateVirtualCard44(tCardsACD); + cardVirtualACE = this.generateVirtualCard44(tCardsACE); + cardVirtualBCD = this.generateVirtualCard44(tCardsBCD); + cardVirtualBCE = this.generateVirtualCard44(tCardsBCE); + cardVirtualCDE = this.generateVirtualCard44(tCardsCDE); + + + tCardsABC[0] = carte4; + tCardsABC[1] = carte5; + tCardsABC[2] = cardVirtualABC[0]; + + tCardsABD[0] = carte3; + tCardsABD[1] = carte5; + tCardsABD[2] = cardVirtualABD[0]; + + tCardsABE[0] = carte3; + tCardsABE[1] = carte4; + tCardsABE[2] = cardVirtualABE[0]; + + tCardsACD[0] = carte2; + tCardsACD[1] = carte5; + tCardsACD[2] = cardVirtualACD[0]; + + tCardsACE[0] = carte2; + tCardsACE[1] = carte4; + tCardsACE[2] = cardVirtualACE[0]; + + tCardsBCD[0] = carte1; + tCardsBCD[1] = carte5; + tCardsBCD[2] = cardVirtualBCD[0]; + + tCardsBCE[0] = carte1; + tCardsBCE[1] = carte4; + tCardsBCE[2] = cardVirtualBCE[0]; + + tCardsCDE[0] = carte1; + tCardsCDE[1] = carte2; + tCardsCDE[2] = cardVirtualCDE[0]; + + card4ABC = this.generateVirtualCard44(tCardsABC); + card4ABD = this.generateVirtualCard44(tCardsABD); + card4ABE = this.generateVirtualCard44(tCardsABE); + card4ACD = this.generateVirtualCard44(tCardsACD); + card4ACE = this.generateVirtualCard44(tCardsACE); + card4BCD = this.generateVirtualCard44(tCardsBCD); + card4BCE = this.generateVirtualCard44(tCardsBCE); + card4CDE = this.generateVirtualCard44(tCardsCDE); + + colors1.splice(0, 1, carte3.color); + colors1.splice(1, 1, card4AB[0].color); + colors1.splice(2, 1, cardVirtualAB[0].color); + + shapes1.splice(0, 1, carte3.shape); + shapes1.splice(1, 1, card4AB[0].shape); + shapes1.splice(2, 1, cardVirtualAB[0].shape); + fills1.splice(0, 1, carte3.fill); + fills1.splice(1, 1, card4AB[0].fill); + fills1.splice(2, 1, cardVirtualAB[0].fill); + + borders1.splice(0, 1, carte3.border); + borders1.splice(1, 1, card4AB[0].border); + borders1.splice(2, 1, cardVirtualAB[0].border); + + numbers1.splice(0, 1, carte3.number); + numbers1.splice(1, 1, card4AB[0].number); + numbers1.splice(2, 1, cardVirtualAB[0].number); + + + colors2.splice(0, 1, carte2.color); + colors2.splice(1, 1, card4AC[0].color); + colors2.splice(2, 1, cardVirtualAC[0].color); + + shapes2.splice(0, 1, carte2.shape); + shapes2.splice(1, 1, card4AC[0].shape); + shapes2.splice(2, 1, cardVirtualAC[0].shape); + + fills2.splice(0, 1, carte2.fill); + fills2.splice(1, 1, card4AC[0].fill); + fills2.splice(2, 1, cardVirtualAC[0].fill); + + borders2.splice(0, 1, carte2.border); + borders2.splice(1, 1, card4AC[0].border); + borders2.splice(2, 1, cardVirtualAC[0].border); + + numbers2.splice(0, 1, carte2.number); + numbers2.splice(1, 1, card4AC[0].number); + numbers2.splice(2, 1, cardVirtualAC[0].number); + + + colors3.splice(0, 1, carte1.color); + colors3.splice(1, 1, card4BC[0].color); + colors3.splice(2, 1, cardVirtualBC[0].color); + + shapes3.splice(0, 1, carte1.shape); + shapes3.splice(1, 1, card4BC[0].shape); + shapes3.splice(2, 1, cardVirtualBC[0].shape); + + fills3.splice(0, 1, carte1.fill); + fills3.splice(1, 1, card4BC[0].fill); + fills3.splice(2, 1, cardVirtualBC[0].fill); + + borders3.splice(0, 1, carte1.border); + borders3.splice(1, 1, card4BC[0].border); + borders3.splice(2, 1, cardVirtualBC[0].border); + + numbers3.splice(0, 1, carte1.number); + numbers3.splice(1, 1, card4BC[0].number); + numbers3.splice(2, 1, cardVirtualBC[0].number); + + + //console.log('Card4 : ' + shapes1[0] + colors1[0] +fills1[0]+ numbers1[0] ); + + //if(this.cardInListOfCards44(shapes1[3],colors1[3],fills1[3],numbers1[3] )){} + + for (a = k + 1; a < self.cardsHS1.length; a++) { + if (shapes1[2] !== undefined && colors1[2] !== undefined && fills1[2] !== undefined && borders1[2] !== undefined && numbers1[2] !== undefined) { + if (shapes1[1] !== undefined && colors1[1] !== undefined && fills1[1] !== undefined && borders1[1] !== undefined && numbers1[1] !== undefined) { + if (shapes1[1] === shapesall[a] && colors1[1] === colorsall[a] && fills1[1] === fillsall[a] && borders1[1] === bordersall[a] && numbers1[1] === numbersall[a]) { + //console.log('ab'); + //console.log(shapes1, colors1, fills1, borders1, numbers1); + //console.log(carte1); + //console.log(carte2); + self.setHS1 = self.setHS1 + 1; + } + } + } + } + + + for (a = k + 1; a < self.cardsHS1.length; a++) { + if (shapes2[2] !== undefined && colors2[2] !== undefined && fills2[2] !== undefined && borders2[2] !== undefined && numbers2[2] !== undefined) { + if (shapes1[1] !== undefined && colors1[1] !== undefined && fills1[1] !== undefined && borders2[2] !== undefined && numbers2[1] !== undefined) { + if (shapes2[1] === shapesall[a] && colors2[1] === colorsall[a] && fills2[1] === fillsall[a] && numbers2[1] === numbersall[a]) { + //console.log('ac'); + //console.log(shapes2, colors2, fills2, borders2, numbers2); + self.setHS1 = self.setHS1 + 1; + } + } + } + } + + + for (a = k + 1; a < self.cardsHS1.length; a++) { + if (shapes3[2] !== undefined && colors3[2] !== undefined && fills3[2] !== undefined && borders3[2] !== undefined && numbers3[2] !== undefined) { + if (shapes3[1] !== undefined && colors3[1] !== undefined && fills3[1] !== undefined && borders3[1] !== undefined && numbers3[1] !== undefined) { + if (shapes3[1] === shapesall[a] && colors3[1] === colorsall[a] && fills3[1] === fillsall[a] && borders3[1] === bordersall[a] && numbers3[1] === numbersall[a]) { + //console.log('bc'); + //console.log(shapes3, colors3, fills3, borders3, numbers3); + self.setHS1 = self.setHS1 + 1; + } + } + } + } + + + } + } + } + } + } + + this.$nbSetsHS1.html(self.setHS1); + }, @@ -2956,8 +3329,545 @@ var Game = { return cards4; }, + generateVirtualCard45: function(cards1){ + + var colors2= $.map(cards1, function(el) { return $(el).data("color");}); + var shapes2 = $.map(cards1, function(el) { return $(el).data("shape");}); + var fills2 = $.map(cards1, function(el) { return $(el).data("fill");}); + var borders2 = $.map(cards1, function(el) { return $(el).data("border");}); + var numbers2 = $.map(cards1, function(el) { return $(el).data("number");}); + + if (shapes2[0] === undefined && colors2[0] === undefined && fills2[0] === undefined && borders2[0] === undefined && numbers2[0] === undefined) { + colors2= $.map(cards1, function(el) { return el.color;}); + shapes2 = $.map(cards1, function(el) { return el.shape;}); + fills2 = $.map(cards1, function(el) { return el.fill;}); + borders2 = $.map(cards1, function(el) { return el.border;}); + numbers2 = $.map(cards1, function(el) { return el.number;}); + } + + + if (colors2[0] === colors2[1] && colors2[0] === colors2[2]) { + colors2.push(colors2[0]); + + } else { + if (colors2[0] === 'red' && colors2[1] === 'green' && colors2[2] === 'purple') { + colors2.push('lightblue'); + } + + if (colors2[0] === 'red' && colors2[1] === 'purple' && colors2[2] === 'green') { + colors2.push('lightblue'); + } + + if (colors2[0] === 'purple' && colors2[1] === 'red' && colors2[2] === 'green') { + colors2.push('lightblue'); + } + if (colors2[0] === 'purple' && colors2[1] === 'green' && colors2[2] === 'red') { + colors2.push('lightblue'); + } + + if (colors2[0] === 'green' && colors2[1] === 'purple' && colors2[2] === 'red') { + colors2.push('lightblue'); + } + if (colors2[0] === 'green' && colors2[1] === 'red' && colors2[2] === 'purple') { + colors2.push('lightblue'); + } + + + if (colors2[0] === 'green' && colors2[1] === 'purple' && colors2[2] === 'lightblue') { + colors2.push('red'); + + } + + if (colors2[0] === 'green' && colors2[1] === 'lightblue' && colors2[2] === 'purple') { + colors2.push('red'); + } + + if (colors2[0] === 'purple' && colors2[1] === 'lightblue' && colors2[2] === 'green') { + colors2.push('red'); + } + if (colors2[0] === 'purple' && colors2[1] === 'green' && colors2[2] === 'lightblue') { + colors2.push('red'); + } + + if (colors2[0] === 'lightblue' && colors2[1] === 'purple' && colors2[2] === 'green') { + colors2.push('red'); + } + if (colors2[0] === 'lightblue' && colors2[1] === 'green' && colors2[2] === 'purple') { + colors2.push('red'); + } + + + if (colors2[0] === 'red' && colors2[1] === 'green' && colors2[2] === 'lightblue') { + colors2.push('purple'); + } + + if (colors2[0] === 'red' && colors2[1] === 'lightblue' && colors2[2] === 'green') { + colors2.push('purple'); + } + + if (colors2[0] === 'lightblue' && colors2[1] === 'green' && colors2[2] === 'red') { + colors2.push('purple'); + } + if (colors2[0] === 'lightblue' && colors2[1] === 'red' && colors2[2] === 'green') { + colors2.push('purple'); + } + + if (colors2[0] === 'green' && colors2[1] === 'lightblue' && colors2[2] === 'red') { + colors2.push('purple'); + } + if (colors2[0] === 'green' && colors2[1] === 'red' && colors2[2] === 'lightblue') { + colors2.push('purple'); + } + + + if (colors2[0] === 'red' && colors2[1] === 'purple' && colors2[2] === 'lightblue') { + colors2.push('green'); + } + + if (colors2[0] === 'red' && colors2[1] === 'lightblue' && colors2[2] === 'purple') { + colors2.push('green'); + } + + if (colors2[0] === 'lightblue' && colors2[1] === 'purple' && colors2[2] === 'red') { + colors2.push('green'); + } + if (colors2[0] === 'lightblue' && colors2[1] === 'red' && colors2[2] === 'purple') { + colors2.push('green'); + } + + if (colors2[0] === 'purple' && colors2[1] === 'lightblue' && colors2[2] === 'red') { + colors2.push('green'); + } + if (colors2[0] === 'purple' && colors2[1] === 'red' && colors2[2] === 'lightblue') { + colors2.push('green'); + } + + } + + + if (shapes2[0] === shapes2 [1] && shapes2[0] === shapes2 [2]) { + shapes2.push(shapes2[0]); + } else { + if (shapes2[0] === 'oval' && shapes2[1] === 'diamond' && shapes2[2] === 'wave') { + shapes2.push('rectangle'); + } + + if (shapes2[0] === 'oval' && shapes2[1] === 'wave' && shapes2[2] === 'diamond') { + shapes2.push('rectangle'); + } + + if (shapes2[0] === 'wave' && shapes2[1] === 'diamond' && shapes2[2] === 'oval') { + shapes2.push('rectangle'); + + } + if (shapes2[0] === 'wave' && shapes2[1] === 'oval' && shapes2[2] === 'diamond') { + shapes2.push('rectangle'); + } + + if (shapes2[0] === 'diamond' && shapes2[1] === 'oval' && shapes2[2] === 'wave') { + shapes2.push('rectangle'); + } + if (shapes2[0] === 'diamond' && shapes2[1] === 'wave' && shapes2[2] === 'oval') { + shapes2.push('rectangle'); + } + + + if (shapes2[0] === 'oval' && shapes2[1] === 'diamond' && shapes2[2] === 'rectangle') { + shapes2.push('wave'); + } + + if (shapes2[0] === 'oval' && shapes2[1] === 'rectangle' && shapes2[2] === 'diamond') { + shapes2.push('wave'); + } + + if (shapes2[0] === 'rectangle' && shapes2[1] === 'oval' && shapes2[2] === 'diamond') { + shapes2.push('wave'); + + } + if (shapes2[0] === 'rectangle' && shapes2[1] === 'diamond' && shapes2[2] === 'oval') { + shapes2.push('wave'); + } + + if (shapes2[0] === 'diamond' && shapes2[1] === 'oval' && shapes2[2] === 'rectangle') { + shapes2.push('wave'); + } + if (shapes2[0] === 'diamond' && shapes2[1] === 'rectangle' && shapes2[2] === 'oval') { + shapes2.push('wave'); + } + if (shapes2[0] === 'oval' && shapes2[1] === 'wave' && shapes2[2] === 'rectangle') { + shapes2.push('diamond'); + } + + if (shapes2[0] === 'oval' && shapes2[1] === 'rectangle' && shapes2[2] === 'wave') { + shapes2.push('diamond'); + } + + if (shapes2[0] === 'rectangle' && shapes2[1] === 'wave' && shapes2[2] === 'oval') { + shapes2.push('diamond'); + + } + if (shapes2[0] === 'rectangle' && shapes2[1] === 'oval' && shapes2[2] === 'wave') { + shapes2.push('diamond'); + } + + if (shapes2[0] === 'wave' && shapes2[1] === 'oval' && shapes2[2] === 'rectangle') { + shapes2.push('diamond'); + } + if (shapes2[0] === 'wave' && shapes2[1] === 'rectangle' && shapes2[2] === 'oval') { + shapes2.push('diamond'); + } + + + if (shapes2[0] === 'diamond' && shapes2[1] === 'wave' && shapes2[2] === 'rectangle') { + shapes2.push('oval'); + } + + if (shapes2[0] === 'diamond' && shapes2[1] === 'rectangle' && shapes2[2] === 'wave') { + shapes2.push('oval'); + } + + if (shapes2[0] === 'rectangle' && shapes2[1] === 'wave' && shapes2[2] === 'diamond') { + shapes2.push('oval'); + + } + if (shapes2[0] === 'rectangle' && shapes2[1] === 'diamond' && shapes2[2] === 'wave') { + shapes2.push('oval'); + } + + if (shapes2[0] === 'wave' && shapes2[1] === 'diamond' && shapes2[2] === 'rectangle') { + shapes2.push('oval'); + } + if (shapes2[0] === 'wave' && shapes2[1] === 'rectangle' && shapes2[2] === 'diamond') { + shapes2.push('oval'); + } + + } + if (fills2[0] === fills2 [1] && fills2[0] === fills2 [2]) { + fills2.push(fills2[0]); + } else { + if (fills2[0] === 'solid' && fills2[1] === 'stripped' && fills2[2] === 'open') { + fills2.push('quadrillage'); + } + + if (fills2[0] === 'solid' && fills2[1] === 'open' && fills2[2] === 'stripped') { + fills2.push('quadrillage'); + } + + if (fills2[0] === 'stripped' && fills2[1] === 'open' && fills2[2] === 'solid') { + fills2.push('quadrillage'); + } + if (fills2[0] === 'stripped' && fills2[1] === 'solid' && fills2[2] === 'open') { + fills2.push('quadrillage'); + } + + if (fills2[0] === 'open' && fills2[1] === 'stripped' && fills2[2] === 'solid') { + fills2.push('quadrillage'); + } + if (fills2[0] === 'open' && fills2[1] === 'solid' && fills2[2] === 'stripped') { + fills2.push('quadrillage'); + } + + + if (fills2[0] === 'solid' && fills2[1] === 'stripped' && fills2[2] === 'quadrillage') { + fills2.push('open'); + } + + if (fills2[0] === 'solid' && fills2[1] === 'quadrillage' && fills2[2] === 'stripped') { + fills2.push('open'); + } + + if (fills2[0] === 'quadrillage' && fills2[1] === 'solid' && fills2[2] === 'stripped') { + fills2.push('open'); + } + if (fills2[0] === 'quadrillage' && fills2[1] === 'stripped' && fills2[2] === 'solid') { + fills2.push('open'); + } + + if (fills2[0] === 'stripped' && fills2[1] === 'quadrillage' && fills2[2] === 'solid') { + fills2.push('open'); + } + if (fills2[0] === 'stripped' && fills2[1] === 'solid' && fills2[2] === 'quadrillage') { + fills2.push('open'); + } + + + if (fills2[0] === 'solid' && fills2[1] === 'open' && fills2[2] === 'quadrillage') { + fills2.push('stripped'); + } + + if (fills2[0] === 'solid' && fills2[1] === 'quadrillage' && fills2[2] === 'open') { + fills2.push('stripped'); + } + + if (fills2[0] === 'quadrillage' && fills2[1] === 'solid' && fills2[2] === 'open') { + fills2.push('stripped'); + } + if (fills2[0] === 'quadrillage' && fills2[1] === 'open' && fills2[2] === 'solid') { + fills2.push('stripped'); + } + + if (fills2[0] === 'open' && fills2[1] === 'quadrillage' && fills2[2] === 'solid') { + fills2.push('stripped'); + } + if (fills2[0] === 'open' && fills2[1] === 'solid' && fills2[2] === 'quadrillage') { + fills2.push('stripped'); + } + + + if (fills2[0] === 'stripped' && fills2[1] === 'open' && fills2[2] === 'quadrillage') { + fills2.push('solid'); + } + + if (fills2[0] === 'stripped' && fills2[1] === 'quadrillage' && fills2[2] === 'open') { + fills2.push('solid'); + } + + if (fills2[0] === 'quadrillage' && fills2[1] === 'stripped' && fills2[2] === 'open') { + fills2.push('solid'); + } + if (fills2[0] === 'quadrillage' && fills2[1] === 'open' && fills2[2] === 'stripped') { + fills2.push('solid'); + } + + if (fills2[0] === 'open' && fills2[1] === 'quadrillage' && fills2[2] === 'stripped') { + fills2.push('solid'); + } + if (fills2[0] === 'open' && fills2[1] === 'stripped' && fills2[2] === 'quadrillage') { + fills2.push('solid'); + } + + + } + + + if (borders2[0] === borders2 [1] && borders2[0] === borders2 [2]) { + borders2.push(borders2[0]); + } else { + if (borders2[0] === 'rond' && borders2[1] === 'point' && borders2[2] === 'plein') { + borders2.push('zigzag'); + } + + if (borders2[0] === 'rond' && borders2[1] === 'plein' && borders2[2] === 'point') { + borders2.push('zigzag'); + } + + if (borders2[0] === 'plein' && borders2[1] === 'rond' && borders2[2] === 'point') { + borders2.push('zigzag'); + } + if (borders2[0] === 'plein' && borders2[1] === 'point' && borders2[2] === 'rond') { + borders2.push('zigzag'); + } + + if (borders2[0] === 'point' && borders2[1] === 'rond' && borders2[2] === 'plein') { + borders2.push('zigzag'); + } + if (borders2[0] === 'point' && borders2[1] === 'plein' && borders2[2] === 'rond') { + borders2.push('zigzag'); + } + + + if (borders2[0] === 'rond' && borders2[1] === 'point' && borders2[2] === 'zigzag') { + borders2.push('plein'); + } + + if (borders2[0] === 'rond' && borders2[1] === 'zigzag' && borders2[2] === 'point') { + borders2.push('plein'); + } + + if (borders2[0] === 'zigzag' && borders2[1] === 'point' && borders2[2] === 'rond') { + borders2.push('plein'); + } + if (borders2[0] === 'zigzag' && borders2[1] === 'rond' && borders2[2] === 'point') { + borders2.push('plein'); + } + + if (borders2[0] === 'point' && borders2[1] === 'zigzag' && borders2[2] === 'rond') { + borders2.push('plein'); + } + if (borders2[0] === 'point' && borders2[1] === 'rond' && borders2[2] === 'zigzag') { + borders2.push('plein'); + } + + + if (borders2[0] === 'rond' && borders2[1] === 'zigzag' && borders2[2] === 'plein') { + borders2.push('point'); + } + + if (borders2[0] === 'rond' && borders2[1] === 'plein' && borders2[2] === 'zigzag') { + borders2.push('point'); + } + + if (borders2[0] === 'zigzag' && borders2[1] === 'rond' && borders2[2] === 'plein') { + borders2.push('point'); + } + if (borders2[0] === 'zigzag' && borders2[1] === 'plein' && borders2[2] === 'rond') { + borders2.push('point'); + } + + if (borders2[0] === 'plein' && borders2[1] === 'zigzag' && borders2[2] === 'rond') { + borders2.push('point'); + } + if (borders2[0] === 'plein' && borders2[1] === 'rond' && borders2[2] === 'zigzag') { + borders2.push('point'); + } + + + if (borders2[0] === 'plein' && borders2[1] === 'zigzag' && borders2[2] === 'point') { + borders2.push('rond'); + } + + if (borders2[0] === 'plein' && borders2[1] === 'point' && borders2[2] === 'zigzag') { + borders2.push('rond'); + } + + if (borders2[0] === 'point' && borders2[1] === 'zigzag' && borders2[2] === 'plein') { + borders2.push('rond'); + } + if (borders2[0] === 'point' && borders2[1] === 'plein' && borders2[2] === 'zigzag') { + borders2.push('rond'); + } + + if (borders2[0] === 'zigzag' && borders2[1] === 'point' && borders2[2] === 'plein') { + borders2.push('rond'); + } + if (borders2[0] === 'zigzag' && borders2[1] === 'plein' && borders2[2] === 'point') { + borders2.push('rond'); + } + + + } + + + + if (numbers2[0] === numbers2[1] && numbers2[0] === numbers2[2]) { + numbers2.push(numbers2[0]); + } else { + if (numbers2[0] === 1 && numbers2[1] === 2 && numbers2[2] === 3) { + numbers2.push(4); + } + + if (numbers2[0] === 1 && numbers2[1] === 3 && numbers2[2] === 2) { + numbers2.push(4); + } + + if (numbers2[0] === 2 && numbers2[1] === 1 && numbers2[2] === 3) { + numbers2.push(4); + } + if (numbers2[0] === 2 && numbers2[1] === 3 && numbers2[2] === 1) { + numbers2.push(4); + } + + if (numbers2[0] === 3 && numbers2[1] === 1 && numbers2[2] === 2) { + numbers2.push(4); + } + if (numbers2[0] === 3 && numbers2[1] === 2 && numbers2[2] === 1) { + numbers2.push(4); + } + + + if (numbers2[0] === 1 && numbers2[1] === 2 && numbers2[2] === 4) { + numbers2.push(3); + } + + if (numbers2[0] === 1 && numbers2[1] === 4 && numbers2[2] === 2) { + numbers2.push(3); + } + + if (numbers2[0] === 2 && numbers2[1] === 1 && numbers2[2] === 4) { + numbers2.push(3); + } + if (numbers2[0] === 2 && numbers2[1] === 4 && numbers2[2] === 1) { + numbers2.push(3); + } + + if (numbers2[0] === 4 && numbers2[1] === 1 && numbers2[2] === 2) { + numbers2.push(3); + } + if (numbers2[0] === 4 && numbers2[1] === 2 && numbers2[2] === 1) { + numbers2.push(3); + } + + + if (numbers2[0] === 1 && numbers2[1] === 3 && numbers2[2] === 4) { + numbers2.push(2); + } + + if (numbers2[0] === 1 && numbers2[1] === 4 && numbers2[2] === 3) { + numbers2.push(2); + } + + if (numbers2[0] === 3 && numbers2[1] === 1 && numbers2[2] === 4) { + numbers2.push(2); + } + if (numbers2[0] === 3 && numbers2[1] === 4 && numbers2[2] === 1) { + numbers2.push(2); + } + + if (numbers2[0] === 4 && numbers2[1] === 1 && numbers2[2] === 3) { + numbers2.push(2); + } + if (numbers2[0] === 4 && numbers2[1] === 3 && numbers2[2] === 1) { + numbers2.push(2); + } + + + if (numbers2[0] === 2 && numbers2[1] === 3 && numbers2[2] === 4) { + numbers2.push(1); + } + + if (numbers2[0] === 2 && numbers2[1] === 4 && numbers2[2] === 3) { + numbers2.push(1); + } + + if (numbers2[0] === 3 && numbers2[1] === 2 && numbers2[2] === 4) { + numbers2.push(1); + } + if (numbers2[0] === 3 && numbers2[1] === 4 && numbers2[2] === 2) { + numbers2.push(1); + } + + if (numbers2[0] === 4 && numbers2[1] === 2 && numbers2[2] === 3) { + numbers2.push(1); + } + if (numbers2[0] === 4 && numbers2[1] === 3 && numbers2[2] === 2) { + numbers2.push(1); + } + } + + var cards4 =[]; + /*cards4.push({ + shape: shapes2[0], + fill: fills2[0], + color: colors2[0], + number: numbers2[0] + }); + cards4.push({ + shape: shapes2[1], + fill: fills2[1], + color: colors2[1], + number: numbers2[1] + }); + + cards4.push({ + shape: shapes2[2], + fill: fills2[2], + color: colors2[2], + number: numbers2[2] + });*/ + + cards4.push({ + shape: shapes2[3], + fill: fills2[3], + color: colors2[3], + border: borders2[3], + number: numbers2[3] + }); + + return cards4; + }, + @@ -3612,7 +4522,7 @@ var Game = { if (!data.gameComplete) { self.set3 = 0; //self.updateCards3(data); - //self.existingSet3(); + self.existingSet3(); self.increaseScore3(); } else { self.gameWon();