HyperSet
+
+
@@ -319,10 +323,6 @@
-
diff --git a/HyperSet/vues/js/set.js b/HyperSet/vues/js/set.js
index 1179d38..18fe9c4 100644
--- a/HyperSet/vues/js/set.js
+++ b/HyperSet/vues/js/set.js
@@ -344,7 +344,7 @@ var Game = {
dataType: 'json',
success: function (data) {
self.cardsHS2 = data;
- // self.existingHyperSet2();
+ self.existingHyperSet2();
self.displayCardsHS2.call(self);
self.setCardListenersHS2();
}
@@ -2710,6 +2710,7 @@ var Game = {
},
generer16Cartes: function(colors, shapes, fills, numbers, allCards){
+ var i = 0;
var possibleCards = [];
var colors1 = [];
var shapes1 =[];
@@ -2870,7 +2871,8 @@ var Game = {
fill : fills1[0],
number: numbers1[0]
});
- possibleCards.push(card1);
+ possibleCards[i] = card1;
+ i = i +1;
}
if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
if(colors2[0] !== undefined) {
@@ -2880,7 +2882,8 @@ var Game = {
fill: fills1[0],
number: numbers1[0]
});
- possibleCards.push(card2);
+ possibleCards[i] = card2;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -2891,7 +2894,8 @@ var Game = {
fill: fills1[0],
number: numbers1[0]
});
- possibleCards.push(card3);
+ possibleCards[i] = card3;
+ i = i +1;
}
}
if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -2902,7 +2906,8 @@ var Game = {
fill: fills2[0],
number: numbers1[0]
});
- possibleCards.push(card4);
+ possibleCards[i] = card4;
+ i = i +1;
}
}
if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -2913,7 +2918,8 @@ var Game = {
fill: fills1[0],
number: numbers2[0]
});
- possibleCards.push(card5);
+ possibleCards[i] = card5;
+ i = i +1;
}
}
@@ -2930,7 +2936,8 @@ var Game = {
fill: fills2[0],
number: numbers2[0]
});
- possibleCards.push(card6);
+ possibleCards[i] = card6;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -2941,7 +2948,8 @@ var Game = {
fill: fills1[0],
number: numbers2[0]
});
- possibleCards.push(card7);
+ possibleCards[i] = card7;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -2952,7 +2960,8 @@ var Game = {
fill: fills2[0],
number: numbers1[0]
});
- possibleCards.push(card8);
+ possibleCards[i] = card8;
+ i = i +1;
}
}
if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -2963,7 +2972,8 @@ var Game = {
fill: fills2[0],
number: numbers1[0]
});
- possibleCards.push(card9);
+ possibleCards[i] = card9;
+ i = i +1;
}
}
if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -2974,7 +2984,8 @@ var Game = {
fill: fills1[0],
number: numbers2[0]
});
- possibleCards.push(card10);
+ possibleCards[i] = card10;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -2985,7 +2996,8 @@ var Game = {
fill: fills1[0],
number: numbers1[0]
});
- possibleCards.push(card11);
+ possibleCards[i] = card11;
+ i = i +1;
}
}
@@ -2998,7 +3010,8 @@ var Game = {
fill: fills2[0],
number: numbers2[0]
});
- possibleCards.push(card12);
+ possibleCards[i] = card12;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers1[0] === numbersall[a]) {
@@ -3009,7 +3022,8 @@ var Game = {
fill: fills2[0],
number: numbers1[0]
});
- possibleCards.push(card13);
+ possibleCards[i] = card13;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -3020,7 +3034,8 @@ var Game = {
fill: fills1[0],
number: numbers2[0]
});
- possibleCards.push(card14);
+ possibleCards[i] = card14;
+ i = i +1;
}
}
if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -3031,7 +3046,8 @@ var Game = {
fill: fills2[0],
number: numbers2[0]
});
- possibleCards.push(card15);
+ possibleCards[i] = card15;
+ i = i +1;
}
}
if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && numbers2[0] === numbersall[a]) {
@@ -3042,7 +3058,8 @@ var Game = {
fill: fills2[0],
number: numbers2[0]
});
- possibleCards.push(card16);
+ possibleCards[i] = card16;
+ i = i +1;
}
}
@@ -3050,522 +3067,946 @@ var Game = {
return possibleCards;
},
- existingHyperSet2: function() {
+
+ generer16Cartes5: function(colors, shapes, fills, borders, numbers, allCards) {
+ var i = 0;
+ var possibleCards = [];
var colors1 = [];
- var shapes1 =[];
- var fills1= [];
- var numbers1= [];
+ var shapes1 = [];
+ var fills1 = [];
+ var borders1 = [];
+ var numbers1 = [];
var colors2 = [];
- var shapes2 =[];
- var fills2= [];
- var numbers2= [];
- var colors3 = [];
- var shapes3 =[];
- var fills3= [];
- var numbers3= [];
+ var shapes2 = [];
+ var fills2 = [];
+ var borders2 = [];
+ var numbers2 = [];
+
+ var card1 = [];
+ var card2 = [];
+ var card3 = [];
+ var card4 = [];
+ var card5 = [];
+ var card6 = [];
+ var card7 = [];
+ var card8 = [];
+ var card9 = [];
+ var card10 = [];
+ var card11 = [];
+ var card12 = [];
+ var card13 = [];
+ var card14 = [];
+ var card15 = [];
+ var card16 = [];
+ var card17 = [];
+ var card18 = [];
+ var card19 = [];
+ var card20 = [];
+ var card21 = [];
+ var card22 = [];
+ var card23 = [];
+ var card24 = [];
+ var card25 = [];
+ var card26 = [];
+ var card27 = [];
+ var card28 = [];
+ var card29 = [];
+ var card30 = [];
+ var card31 = [];
+ var card32 = [];
+
+
+
+
+ var colorsall = $.map(allCards, function (el) {
+ return el.color;
+ });
+ var shapesall = $.map(allCards, function (el) {
+ return el.shape;
+ });
+ var fillsall = $.map(allCards, function (el) {
+ return el.fill;
+ });
+ var bordersall = $.map(allCards, function (el) {
+ return el.border;
+ });
+ var numbersall = $.map(allCards, function (el) {
+ return el.number;
+ });
- var colors4 = [];
- var shapes4 =[];
- var fills4= [];
- var numbers4= [];
- var colors5 = [];
- var shapes5 =[];
- var fills5= [];
- var numbers5= [];
- var colors6 = [];
- var shapes6 =[];
- var fills6= [];
- var numbers6= [];
- var colors7 = [];
- var shapes7 =[];
- var fills7= [];
- var numbers7= [];
- var colors8 = [];
- var shapes8 =[];
- var fills8= [];
- var numbers8= [];
+ var colorsSet = new Set(colors);
+ var shapesSet = new Set(shapes);
+ var fillsSet = new Set(fills);
+ var bordersSet = new Set(borders);
+ var numbersSet = new Set(numbers);
+ if (colors[0] === colors[1]) {
+ colors1.push(colors[1]);
+ } else {
+ if (colorsSet.has('green') && colorsSet.has('red')) {
+ colors1.push('purple');
+ colors2.push('lightblue');
+ }
+ if (colorsSet.has('green') && colorsSet.has('purple')) {
+ colors1.push('red');
+ colors2.push('lightblue');
+ }
+ if (colorsSet.has('green') && colorsSet.has('lightblue')) {
+ colors1.push('red');
+ colors2.push('purple');
+ }
+ if (colorsSet.has('red') && colorsSet.has('purple')) {
+ colors1.push('green');
+ colors2.push('lightblue');
+ }
+ if (colorsSet.has('red') && colorsSet.has('lightblue')) {
+ colors1.push('green');
+ colors2.push('purple');
+ }
+ if (colorsSet.has('purple') && colorsSet.has('lightblue')) {
+ colors1.push('green');
+ colors2.push('red');
+ }
+ }
+ if (shapes[0] === shapes[1]) {
+ shapes1.push(shapes[1]);
+ } else {
+ if (shapesSet.has('oval') && shapesSet.has('diamond')) {
+ shapes1.push('rectangle');
+ shapes2.push('wave');
+ }
+ if (shapesSet.has('oval') && shapesSet.has('rectangle')) {
+ shapes1.push('diamond');
+ shapes2.push('wave');
+ }
+ if (shapesSet.has('oval') && shapesSet.has('wave')) {
+ shapes1.push('diamond');
+ shapes2.push('rectangle');
+ }
+ if (shapesSet.has('diamond') && shapesSet.has('rectangle')) {
+ shapes1.push('oval');
+ shapes2.push('wave');
+ }
+ if (shapesSet.has('diamond') && shapesSet.has('wave')) {
+ shapes1.push('oval');
+ shapes2.push('rectangle');
+ }
+ if (shapesSet.has('rectangle') && shapesSet.has('wave')) {
+ shapes1.push('diamond');
+ shapes2.push('oval');
+ }
+ }
+ if (fills[0] === fills[1]) {
+ fills1.push(fills[1]);
+ } else {
+ if (fillsSet.has('solid') && fillsSet.has('open')) {
+ fills1.push('quadrillage');
+ fills2.push('stripped');
+ }
+ if (fillsSet.has('solid') && fillsSet.has('quadrillage')) {
+ fills1.push('open');
+ fills2.push('stripped');
+ }
+ if (fillsSet.has('solid') && fillsSet.has('stripped')) {
+ fills1.push('quadrillage');
+ fills2.push('stripped');
+ }
+ if (fillsSet.has('open') && fillsSet.has('quadrillage')) {
+ fills1.push('solid');
+ fills2.push('wave');
+ }
+ if (fillsSet.has('open') && fillsSet.has('stripped')) {
+ fills1.push('solid');
+ fills2.push('quadrillage');
+ }
+ if (fillsSet.has('stripped') && fillsSet.has('quadrillage')) {
+ fills1.push('solid');
+ fills2.push('open');
+ }
+ }
- var self = this;
- var cartes = self.cardsHS2;
- var cartes1 = cartes;
- var cartes2 = cartes;
- var cartes3 = cartes;
- var cartes4 = cartes;
+ if (borders[0] === borders[1]) {
+ borders1.push(borders[1]);
+ } else {
+ if (bordersSet.has('plein') && bordersSet.has('point')) {
+ borders1.push('rond');
+ borders2.push('zigzag');
+ }
+ if (bordersSet.has('plein') && bordersSet.has('rond')) {
+ borders1.push('point');
+ borders2.push('zigzag');
+ }
+ if (bordersSet.has('plein') && bordersSet.has('zigzag')) {
+ borders1.push('point');
+ borders2.push('rond');
+ }
+ if (bordersSet.has('point') && bordersSet.has('rond')) {
+ borders1.push('plein');
+ borders2.push('zigzag');
+ }
+ if (bordersSet.has('point') && bordersSet.has('zigzag')) {
+ borders1.push('plein');
+ borders2.push('rond');
+ }
+ if (bordersSet.has('rond') && bordersSet.has('zigzag')) {
+ borders1.push('plein');
+ borders2.push('point');
+ }
+ }
- var carte1, carte3, carte4, carte5, carte6 =[];
- var carte2;
- var card6ABC = [];
- var card6ABD = [];
- var card6ABE = [];
- var card6ACD = [];
- var card6ACE = [];
- var card6BCD = [];
- var card6BCE = [];
- var card6CDE = [];
- var cardVirtualABC = [];
- var cardVirtualABD = [];
- var cardVirtualABE = [];
- var cardVirtualACD = [];
- var cardVirtualACE = [];
- var cardVirtualBCD = [];
- var cardVirtualBCE = [];
- var cardVirtualCDE = [];
+ if (numbers[0] === numbers[1]) {
+ numbers1.push(numbers[1]);
+ } else {
+ if (numbersSet.has(1) && numbersSet.has(2)) {
+ numbers1.push(3);
+ numbers2.push(4);
+ }
+ if (numbersSet.has(1) && numbersSet.has(3)) {
+ numbers1.push(2);
+ numbers2.push(4);
+ }
+ if (numbersSet.has(1) && numbersSet.has(4)) {
+ numbers1.push(2);
+ numbers2.push(3);
+ }
+ if (numbersSet.has(2) && numbersSet.has(3)) {
+ numbers1.push(1);
+ numbers2.push(4);
+ }
+ if (numbersSet.has(2) && numbersSet.has(4)) {
+ numbers1.push(1);
+ numbers2.push(3);
+ }
+ if (numbersSet.has(3) && numbersSet.has(4)) {
+ numbers1.push(1);
+ numbers2.push(2);
+ }
+ }
- var tCardsABC = [];
- var tCardsABD = [];
- var tCardsABE = [];
- var tCardsACD = [];
- var tCardsACE = [];
- var tCardsBCD = [];
- var tCardsBCE = [];
- var tCardsCDE = [];
+ for (var a = 0; a < allCards.length; a++) {
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ card1.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ console.log(card1);
+ possibleCards[i] = card1;
+ i = i + 1;
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined) {
+ card2.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card2;
+ i = i + 1;
+ }
+ }
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined) {
+ card3.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card3;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (fills2[0] !== undefined) {
+ card4.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card4;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (borders2[0] !== undefined) {
+ card4.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card5;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (numbers2[0] !== undefined) {
+ card5.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card6;
+ i = i + 1;
+ }
+ }
- var tCardsDGE = [];
- var pCards = [];
- var pCards2 = [];
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (borders2[0] !== undefined && numbers2[0] !== undefined) {
+ card6.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card7;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (fills2[0] !== undefined && numbers2[0] !== undefined) {
+ card7.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card8;
+ i = i + 1;
+ }
+ }
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && numbers2[0] !== undefined) {
+ card7.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card9;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && numbers2[0] !== undefined) {
+ card7.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card10;
+ i = i + 1;
+ }
+ }
- var i, j, a,l, m, k ,z;
- var colorsall= $.map(this.cardsHS2, function(el) { return el.color;});
- var shapesall = $.map(this.cardsHS2, function(el) { return el.shape; });
- var fillsall= $.map(this.cardsHS2,function(el) { return el.fill; });
- var numbersall = $.map(this.cardsHS2, function(el) { return el.number;});
+ if (shapes1[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (fills2[0] !== undefined && borders2[0] !== undefined) {
+ card7.push({
+ color: colors1[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card11;
+ i = i + 1;
+ }
+ }
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && borders2[0] !== undefined) {
+ card7.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card12;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && borders2[0] !== undefined) {
+ card7.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card13;
+ i = i + 1;
+ }
+ }
- 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++) {
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && fills2[0] !== undefined) {
+ card7.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card14;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (fills2[0] !== undefined && colors2[0] !== undefined) {
+ card7.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card15;
+ i = i + 1;
+ }
+ }
- carte1 = cartes[i];
- carte2 = cartes1[j];
- carte4 = cartes2[k];
+ if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && shapes2[0] !== undefined) {
+ card7.push({
+ color: colors2[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card16;
+ i = i + 1;
+ }
+ }
- colors1.splice(0, 1, carte1.color);
- colors1.splice(1, 1, carte2.color);
+ if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && shapes2[0] !== undefined && fills2[0] !== undefined) {
+ card13.push({
+ color: colors2[0],
+ shape: shapes2[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card17;
+ i = i + 1;
+ }
+ }
+ if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && shapes2[0] !== undefined && borders2[0] !== undefined) {
+ card14.push({
+ color: colors2[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card18;
+ i = i + 1;
+ }
+ }
- shapes1.splice(0, 1, carte1.shape);
- shapes1.splice(1, 1, carte2.shape);
+ if (shapes2[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && shapes2[0] !== undefined && numbers2[0] !== undefined) {
+ card14.push({
+ color: colors2[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card19;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && fills2[0] !== undefined && borders2[0] !== undefined) {
+ card15.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card20;
+ i = i + 1;
+ }
+ }
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && fills2[0] !== undefined && numbers2[0] !== undefined) {
+ card15.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card21;
+ i = i + 1;
+ }
+ }
- fills1.splice(0, 1, carte1.fill);
- fills1.splice(1, 1, carte2.fill);
+ if (shapes1[0] === shapesall[a] && colors2[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (colors2[0] !== undefined && borders2[0] !== undefined && numbers2[0] !== undefined) {
+ card15.push({
+ color: colors2[0],
+ shape: shapes1[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card22;
+ i = i + 1;
+ }
- numbers1.splice(0, 1, carte1.number);
- numbers1.splice(1, 1, carte2.number);
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers1[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && fills2[0] !== undefined && borders2[0] !== undefined) {
+ card15.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills2[0],
+ border: borders2[0],
+ number: numbers1[0]
+ });
+ possibleCards[i] = card23;
+ i = i + 1;
+ }
+ }
- pCards = self.generer16Cartes(colors1,shapes1, fills1, numbers1, this.cardsHS2);
+ }
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills2[0] === fillsall[a] && borders1[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && fills2[0] !== undefined && numbers2[0] !== undefined) {
+ card15.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills2[0],
+ border: borders1[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card24;
+ i = i + 1;
+ }
+ }
+ if (shapes2[0] === shapesall[a] && colors1[0] === colorsall[a] && fills1[0] === fillsall[a] && borders2[0] === bordersall[a] && numbers2[0] === numbersall[a]) {
+ if (shapes2[0] !== undefined && borders2[0] !== undefined && numbers2[0] !== undefined) {
+ card15.push({
+ color: colors1[0],
+ shape: shapes2[0],
+ fill: fills1[0],
+ border: borders2[0],
+ number: numbers2[0]
+ });
+ possibleCards[i] = card25;
+ i = i + 1;
+ }
+ }
- for (z=0; z
0) {
+
+ for (z = 0; z < pCards.length; z++) {
+ tCardsABC[0] = carte1;
+ tCardsABC[1] = carte2;
+ tCardsABC[2] = pCards[z][0];
+
- fills2.splice(0, 1, carte3.fill);
- fills1.splice(1, 1, carte5.fill);
- fills2.splice(2, 1, card6ABD[0].fill);
- fills2.splice(3, 1, cardVirtualABD[0].fill);
+ cardVirtualABC[z] = this.generateVirtualCard44(tCardsABC);
- numbers2.splice(0, 1, carte3.number);
- numbers1.splice(1, 1, carte5.number);
- numbers2.splice(2, 1, card6ABD[0].number);
- numbers2.splice(3, 1, cardVirtualABD[0].number);
+ tCardsDGE[0] = carte4;
+ tCardsDGE[1] = cardVirtualABC[z][0];
+ tCardsDGE[2] = [];
- colors3.splice(0, 1, carte3.color);
- colors3.splice(1, 1, carte4.color);
- colors3.splice(2, 1, card6ABE[0].color);
- colors3.splice(3, 1, cardVirtualABE[0].color);
+ colors2 = $.map(tCardsDGE, function (el) {
+ return el.color;
+ });
+ shapes2 = $.map(tCardsDGE, function (el) {
+ return el.shape;
+ });
+ fills2 = $.map(tCardsDGE, function (el) {
+ return el.fill;
+ });
+ numbers2 = $.map(tCardsDGE, function (el) {
+ return el.number;
+ });
- shapes3.splice(0, 1, carte3.shape);
- shapes3.splice(1, 1, carte4.shape);
- shapes3.splice(2, 1, card6ABE[0].shape);
- shapes3.splice(3, 1, cardVirtualABE[0].shape);
+ pCards2 = self.generer16Cartes(colors2, shapes2, fills2, numbers2, this.cardsHS2);
- fills3.splice(0, 1, carte3.fill);
- fills3.splice(1, 1, carte4.fill);
- fills3.splice(2, 1, card6ABE[0].fill);
- fills3.splice(3, 1, cardVirtualABE[0].fill);
+ for (var w = 0; w < pCards2.length; w++) {
+ tCardsDGE[2] = pCards2[w][0];
+ carte6[w] = this.generateVirtualCard44(tCardsDGE);
- numbers3.splice(0, 1, carte3.number);
- numbers3.splice(1, 1, carte4.number);
- numbers3.splice(2, 1, card6ABE[0].number);
- numbers3.splice(3, 1, cardVirtualABE[0].number);
+ }
+ }
+ }
+ for(var x=0; x< carte6.length; x++) {
+ for (a = k + 1; a < self.cardsHS2.length; a++) {
+ if (carte6[x][0].color !== undefined && carte6[x][0].shape !== undefined && carte6[x][0].fill !== undefined && carte6[x][0].number !== undefined) {
+ if (carte6[x][0].shape === shapesall[a] && carte6[x][0].color === colorsall[a] && carte6[x][0].fill === fillsall[a] && carte6[x][0].number === numbersall[a]) {
+ //console.log('ab');
+ //console.log(carte6[x][0].shape, carte6[x][0].color, carte6[x][0].fill, carte6[x][0].number);
+ //console.log(carte1);
+ //console.log(carte2);
+ self.setHS2 = self.setHS2 + 1;
+ }
+ }
+ }
+ }
- colors4.splice(0, 1, carte2.color);
- colors4.splice(1, 1, carte5.color);
- colors4.splice(2, 1, card6ACD[0].color);
- colors4.splice(3, 1, cardVirtualACD[0].color);
+ carte6 = [];
- shapes4.splice(0, 1, carte2.shape);
- shapes4.splice(1, 1, carte5.shape);
- shapes4.splice(2, 1, card6ACD[0].shape);
- shapes4.splice(3, 1, cardVirtualACD[0].shape);
- fills4.splice(0, 1, carte2.fill);
- fills4.splice(1, 1, carte5.fill);
- fills4.splice(2, 1, card6ACD[0].fill);
- fills4.splice(3, 1, cardVirtualACD[0].fill);
+ }
+ }
+ }
- numbers4.splice(0, 1, carte2.number);
- numbers4.splice(1, 1, carte5.number);
- numbers4.splice(2, 1, card6ACD[0].number);
- numbers4.splice(3, 1, cardVirtualACD[0].number);
+ this.$nbSetsHS2.html(self.setHS2);
+ },
- colors5.splice(0, 1, carte2.color);
- colors5.splice(1, 1, carte4.color);
- colors5.splice(2, 1, card6ACE[0].color);
- colors5.splice(3, 1, cardVirtualACE[0].color);
+ existingHyperSet3: function() {
+ var colors1 = [];
+ var shapes1 =[];
+ var fills1= [];
+ var borders1 =[];
+ var numbers1= [];
+ var colors2 = [];
+ var shapes2 =[];
+ var fills2= [];
+ var borders2 =[];
+ var numbers2= [];
- shapes5.splice(0, 1, carte2.shape);
- shapes5.splice(1, 1, carte4.shape);
- shapes5.splice(2, 1, card6ACE[0].shape);
- shapes5.splice(3, 1, cardVirtualACE[0].shape);
- fills5.splice(0, 1, carte2.fill);
- fills5.splice(1, 1, carte4.fill);
- fills5.splice(2, 1, card6ACE[0].fill);
- fills5.splice(3, 1, cardVirtualACE[0].fill);
+ var self = this;
+ var cartes = self.cardsHS3;
+ var cartes1 = cartes;
+ var cartes2 = cartes;
- numbers5.splice(0, 1, carte2.number);
- numbers5.splice(1, 1, carte4.number);
- numbers5.splice(2, 1, card6ACE[0].number);
- numbers5.splice(3, 1, cardVirtualACE[0].number);
+ var carte1, carte4, carte6 =[];
+ var carte2;
+ var cardVirtualABC = [];
- colors6.splice(0, 1, carte1.color);
- colors6.splice(1, 1, carte5.color);
- colors6.splice(2, 1, card6BCD[0].color);
- colors6.splice(3, 1, cardVirtualBCD[0].color);
+ var tCardsABC = [];
- shapes6.splice(0, 1, carte1.shape);
- shapes6.splice(1, 1, carte5.shape);
- shapes6.splice(2, 1, card6BCD[0].shape);
- shapes6.splice(3, 1, cardVirtualBCD[0].shape);
+ var tCardsDGE = [];
+ var pCards = [];
+ var pCards2 = [];
- fills6.splice(0, 1, carte1.fill);
- fills6.splice(1, 1, carte5.fill);
- fills6.splice(2, 1, card6BCD[0].fill);
- fills6.splice(3, 1, cardVirtualBCD[0].fill);
+ var i, j, a, k ,z;
- numbers6.splice(0, 1, carte1.number);
- numbers6.splice(1, 1, carte5.number);
- numbers6.splice(2, 1, card6BCD[0].number);
- numbers6.splice(3, 1, cardVirtualBCD[0].number);
+ var colorsall= $.map(this.cardsHS3, function(el) { return el.color;});
+ var shapesall = $.map(this.cardsHS3, function(el) { return el.shape; });
+ var fillsall= $.map(this.cardsHS3,function(el) { return el.fill; });
+ var bordersall= $.map(this.cardsHS3,function(el) { return el.border; });
+ var numbersall = $.map(this.cardsHS3, 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++) {
- colors7.splice(0, 1, carte1.color);
- colors7.splice(1, 1, carte4.color);
- colors7.splice(2, 1, card6BCE[0].color);
- colors7.splice(3, 1, cardVirtualBCE[0].color);
+ carte1 = cartes[i];
+ carte2 = cartes1[j];
+ carte4 = cartes2[k];
- shapes7.splice(0, 1, carte1.shape);
- shapes7.splice(1, 1, carte4.shape);
- shapes7.splice(2, 1, card6BCE[0].shape);
- shapes7.splice(3, 1, cardVirtualBCE[0].shape);
- fills7.splice(0, 1, carte1.fill);
- fills7.splice(1, 1, carte4.fill);
- fills7.splice(2, 1, card6BCE[0].fill);
- fills7.splice(3, 1, cardVirtualBCE[0].fill);
+ colors1.splice(0, 1, carte1.color);
+ colors1.splice(1, 1, carte2.color);
- numbers7.splice(0, 1, carte1.number);
- numbers7.splice(1, 1, carte4.number);
- numbers7.splice(2, 1, card6BCE[0].number);
- numbers7.splice(3, 1, cardVirtualBCE[0].number);
+ shapes1.splice(0, 1, carte1.shape);
+ shapes1.splice(1, 1, carte2.shape);
+ fills1.splice(0, 1, carte1.fill);
+ fills1.splice(1, 1, carte2.fill);
+ borders1.splice(0, 1, carte1.border);
+ borders1.splice(1, 1, carte2.border);
- colors8.splice(0, 1, carte1.color);
- colors8.splice(1, 1, carte2.color);
- colors8.splice(2, 1, card6CDE[0].color);
- colors8.splice(3, 1, cardVirtualCDE[0].color);
+ numbers1.splice(0, 1, carte1.number);
+ numbers1.splice(1, 1, carte2.number);
- shapes8.splice(0, 1, carte1.shape);
- shapes8.splice(1, 1, carte2.shape);
- shapes8.splice(2, 1, card6CDE[0].shape);
- shapes8.splice(3, 1, cardVirtualCDE[0].shape);
+ pCards = self.generer16Cartes5(colors1, shapes1, fills1, borders1, numbers1, this.cardsHS3);
- fills8.splice(0, 1, carte1.fill);
- fills8.splice(1, 1, carte2.fill);
- fills8.splice(2, 1, card6CDE[0].fill);
- fills8.splice(3, 1, cardVirtualCDE[0].fill);
+ console.log(pCards);
- numbers8.splice(0, 1, carte1.number);
- numbers8.splice(1, 1, carte2.number);
- numbers8.splice(2, 1, card6CDE[0].number);
- numbers8.splice(3, 1, cardVirtualCDE[0].number);
+ if (pCards.length > 0) {
- //console.log('Card4 : ' + shapes1[0] + colors1[0] +fills1[0]+ numbers1[0] );
+ for (z = 0; z < pCards.length; z++) {
+ tCardsABC[0] = carte1;
+ tCardsABC[1] = carte2;
+ tCardsABC[2] = pCards[z][0];
- //if(this.cardInListOfCards44(shapes1[3],colors1[3],fills1[3],numbers1[3] )){}
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes1[2] !== undefined && colors1[2] !== undefined && fills1[2] !== undefined && numbers1[2] !== undefined) {
- if (shapes1[3] !== undefined && colors1[3] !== undefined && fills1[3] !== undefined && numbers1[3] !== undefined) {
- if (shapes1[2] === shapesall[a] && colors1[2] === colorsall[a] && fills1[2] === fillsall[a] && numbers1[2] === numbersall[a]) {
- //console.log('ab');
- //console.log(shapes1, colors1, fills1, borders1, numbers1);
- //console.log(carte1);
- //console.log(carte2);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
+ cardVirtualABC[z] = this.generateVirtualCard45(tCardsABC);
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes2[2] !== undefined && colors2[2] !== undefined && fills2[2] !== undefined && numbers2[2] !== undefined) {
- if (shapes2[3] !== undefined && colors2[3] !== undefined && fills2[3] !== undefined && numbers2[3] !== undefined) {
- if (shapes2[2] === shapesall[a] && colors2[2] === colorsall[a] && fills2[2] === fillsall[a] && numbers2[2] === numbersall[a]) {
- //console.log('ac');
- //console.log(shapes2, colors2, fills2, borders2, numbers2);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
+ tCardsDGE[0] = carte4;
+ tCardsDGE[1] = cardVirtualABC[z][0];
+ tCardsDGE[2] = [];
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes3[2] !== undefined && colors3[2] !== undefined && fills3[2] !== undefined && numbers3[2] !== undefined) {
- if (shapes3[3] !== undefined && colors3[3] !== undefined && fills3[3] !== undefined && numbers3[3] !== undefined) {
- if (shapes3[2] === shapesall[a] && colors3[2] === colorsall[a] && fills3[2] === fillsall[a] && numbers3[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
+ colors2 = $.map(tCardsDGE, function (el) {
+ return el.color;
+ });
+ shapes2 = $.map(tCardsDGE, function (el) {
+ return el.shape;
+ });
+ fills2 = $.map(tCardsDGE, function (el) {
+ return el.fill;
+ });
+ borders2 = $.map(tCardsDGE, function (el) {
+ return el.border;
+ });
+ numbers2 = $.map(tCardsDGE, function (el) {
+ return el.number;
+ });
+ pCards2 = self.generer16Cartes5(colors2, shapes2, fills2, borders2, numbers2, this.cardsHS3);
+ for (var w = 0; w < pCards2.length; w++) {
+ tCardsDGE[2] = pCards2[w][0];
+ carte6[w] = this.generateVirtualCard45(tCardsDGE);
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes4[2] !== undefined && colors4[2] !== undefined && fills4[2] !== undefined && numbers4[2] !== undefined) {
- if (shapes4[3] !== undefined && colors4[3] !== undefined && fills4[3] !== undefined && numbers4[3] !== undefined) {
- if (shapes4[2] === shapesall[a] && colors4[2] === colorsall[a] && fills4[2] === fillsall[a] && numbers4[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes5[2] !== undefined && colors5[2] !== undefined && fills5[2] !== undefined && numbers5[2] !== undefined) {
- if (shapes5[3] !== undefined && colors5[3] !== undefined && fills5[3] !== undefined && numbers5[3] !== undefined) {
- if (shapes5[2] === shapesall[a] && colors5[2] === colorsall[a] && fills5[2] === fillsall[a] && numbers5[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes6[2] !== undefined && colors6[2] !== undefined && fills6[2] !== undefined && numbers6[2] !== undefined) {
- if (shapes6[3] !== undefined && colors6[3] !== undefined && fills6[3] !== undefined && numbers6[3] !== undefined) {
- if (shapes6[2] === shapesall[a] && colors6[2] === colorsall[a] && fills6[2] === fillsall[a] && numbers6[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
}
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes7[2] !== undefined && colors7[2] !== undefined && fills7[2] !== undefined && numbers7[2] !== undefined) {
- if (shapes7[3] !== undefined && colors7[3] !== undefined && fills7[3] !== undefined && numbers7[3] !== undefined) {
- if (shapes7[2] === shapesall[a] && colors7[2] === colorsall[a] && fills7[2] === fillsall[a] && numbers7[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
- }
- }
+ }
+ }
- for (a = k + 1; a < self.cardsHS2.length; a++) {
- if (shapes8[2] !== undefined && colors8[2] !== undefined && fills8[2] !== undefined && numbers8[2] !== undefined) {
- if (shapes8[3] !== undefined && colors8[3] !== undefined && fills8[3] !== undefined && numbers8[3] !== undefined) {
- if (shapes8[2] === shapesall[a] && colors8[2] === colorsall[a] && fills8[2] === fillsall[a] && numbers8[2] === numbersall[a]) {
- //console.log('bc');
- //console.log(shapes3, colors3, fills3, borders3, numbers3);
- self.setHS2 = self.setHS2 + 1;
- }
- }
+ for(var x=0; x< carte6.length; x++) {
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (carte6[x][0].color !== undefined && carte6[x][0].shape !== undefined && carte6[x][0].fill !== undefined && carte6[x][0].border !== undefined && carte6[x][0].number !== undefined) {
+ if (carte6[x][0].shape === shapesall[a] && carte6[x][0].color === colorsall[a] && carte6[x][0].fill === fillsall[a] && carte6[x][0].border === bordersall[a] && carte6[x][0].number === numbersall[a]) {
+ //console.log('ab');
+ //console.log(carte6[x][0].shape, carte6[x][0].color, carte6[x][0].fill, carte6[x][0].number);
+ //console.log(carte1);
+ //console.log(carte2);
+ self.setHS3 = self.setHS3 + 1;
}
}
+ }
+ }
+
+ carte6 = [];
+ pCards = [];
+ pCards2 = [];
- }
- }*/
}
}
}
- this.$nbSetsHS2.html(self.setHS2);
+ this.$nbSetsHS3.html(self.setHS3);
},
- existingHyperSet3: function() {
+/*
+
+
+ existingHyperSet3: function() {
var colors1 = [];
var shapes1 =[];
var fills1= [];
@@ -4084,15 +4525,7 @@ var Game = {
-
-
-
-
-
-
-
-
-
+*/
@@ -5945,6 +6378,7 @@ var Game = {
}
}
+
var card5 = [];
card5.push({
shape: shapes2[4],