'));
+ }
+
+ });
+
+ },
+
+ displayCardsHS4: function() {
+ var self = this;
+ if (self.cards4.length == 0) {
+ return false;
+ }
+
+
+ $.each(self.cardsHS4, function(index, card){
+ var cardNode = $('
', {
+ class: "card"
+ }).appendTo(self.$boardHS4);
+
+
+ cardNode.data({
+ 'id': card.id,
+ 'shape': card.shape,
+ 'fill': card.fill,
+ 'color': card.color,
+ 'border': card.border,
+ 'number': card.number
+ });
+
+ var shapeNode = $("
");
+ shapeNode.append( card.color + '
' + card.shape + '
' + card.fill + '
' + card.border + '
' + card.number);
+
+ /*for (var i = 0; i < card.number; i++) {
+ cardNode.append(shapeNode.clone());
+ }*/
+ cardNode.append(shapeNode);
+
+ self.$boardHS4.append(cardNode);
+
+ // display 4 cards per row
+ if ((index+1) %6 === 0) {
+ self.$boardHS4.append($('
'));
+ }
+
+ });
+
+ },
+
// PARLER SUR CET ALGO SUR LE RAPPORT
@@ -1866,8 +1987,8 @@ var Game = {
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]){
+ if (shapes2[1] !== undefined && colors2[1] !== undefined && fills2[1] !== undefined && borders2[1] !== undefined && numbers2[1] !== undefined) {
+ if(shapes2[1] === shapesall[a] && colors2[1]=== colorsall[a] && fills2[1] === fillsall[a] && borders2[1]=== bordersall[a] && numbers2[1] === numbersall[a]){
//console.log('ac');
//console.log(shapes2, colors2, fills2, borders2, numbers2);
self.setHS1 = self.setHS1 + 1;
@@ -1901,19 +2022,39 @@ var Game = {
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 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 self = this;
var cartes = self.cardsHS2;
var cartes1 = cartes;
@@ -1924,14 +2065,14 @@ var Game = {
var carte1, carte3, carte4, carte5;
var carte2;
- var card4ABC = [];
- var card4ABD = [];
- var card4ABE = [];
- var card4ACD = [];
- var card4ACE = [];
- var card4BCD = [];
- var card4BCE = [];
- var card4CDE = [];
+ var card6ABC = [];
+ var card6ABD = [];
+ var card6ABE = [];
+ var card6ACD = [];
+ var card6ACE = [];
+ var card6BCD = [];
+ var card6BCE = [];
+ var card6CDE = [];
var cardVirtualABC = [];
var cardVirtualABD = [];
@@ -1955,11 +2096,10 @@ var Game = {
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;});
+ 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;});
for(i=0; i < cartes.length-4; i++) {
@@ -2051,117 +2191,286 @@ var Game = {
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);
+ card6ABC = this.generateVirtualCard44(tCardsABC);
+ card6ABD = this.generateVirtualCard44(tCardsABD);
+ card6ABE = this.generateVirtualCard44(tCardsABE);
+ card6ACD = this.generateVirtualCard44(tCardsACD);
+ card6ACE = this.generateVirtualCard44(tCardsACE);
+ card6BCD = this.generateVirtualCard44(tCardsBCD);
+ card6BCE = this.generateVirtualCard44(tCardsBCE);
+ card6CDE = this.generateVirtualCard44(tCardsCDE);
+
+ colors1.splice(0, 1, carte4.color);
+ colors1.splice(1, 1, carte5.color);
+ colors1.splice(2, 1, card6ABC[0].color);
+ colors1.splice(3, 1, cardVirtualABC[0].color);
+
+ shapes1.splice(0, 1, carte4.shape);
+ shapes1.splice(1, 1, carte5.shape);
+ shapes1.splice(2, 1, card6ABC[0].shape);
+ shapes1.splice(3, 1, cardVirtualABC[0].shape);
+
+ fills1.splice(0, 1, carte4.fill);
+ fills1.splice(1, 1, carte5.fill);
+ fills1.splice(2, 1, card6ABC[0].fill);
+ fills1.splice(3, 1, cardVirtualABC[0].fill);
+
+ numbers1.splice(0, 1, carte4.number);
+ numbers1.splice(1, 1, carte5.number);
+ numbers1.splice(2, 1, card6ABC[0].number);
+ numbers1.splice(3, 1, cardVirtualABC[0].number);
+
+
+ colors2.splice(0, 1, carte3.color);
+ colors1.splice(1, 1, carte5.color);
+ colors2.splice(2, 1, card6ABD[0].color);
+ colors2.splice(3, 1, cardVirtualABD[0].color);
+
+ shapes2.splice(0, 1, carte3.shape);
+ shapes1.splice(1, 1, carte5.shape);
+ shapes2.splice(2, 1, card6ABD[0].shape);
+ shapes2.splice(3, 1, cardVirtualABD[0].shape);
+
+ 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);
+
+ 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);
+
+
+ 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);
+
+ 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);
- colors1.splice(0, 1, carte3.color);
- colors1.splice(1, 1, card4AB[0].color);
- colors1.splice(2, 1, cardVirtualAB[0].color);
+ 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);
- shapes1.splice(0, 1, carte3.shape);
- shapes1.splice(1, 1, card4AB[0].shape);
- shapes1.splice(2, 1, cardVirtualAB[0].shape);
+ 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);
- 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);
+ 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);
+
+ 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);
- colors2.splice(0, 1, carte2.color);
- colors2.splice(1, 1, card4AC[0].color);
- colors2.splice(2, 1, cardVirtualAC[0].color);
+ 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);
- shapes2.splice(0, 1, carte2.shape);
- shapes2.splice(1, 1, card4AC[0].shape);
- shapes2.splice(2, 1, cardVirtualAC[0].shape);
+ 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);
- 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);
+ 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);
- numbers2.splice(0, 1, carte2.number);
- numbers2.splice(1, 1, card4AC[0].number);
- numbers2.splice(2, 1, cardVirtualAC[0].number);
+ 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);
- colors3.splice(0, 1, carte1.color);
- colors3.splice(1, 1, card4BC[0].color);
- colors3.splice(2, 1, cardVirtualBC[0].color);
+ 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);
- 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);
+ 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);
- borders3.splice(0, 1, carte1.border);
- borders3.splice(1, 1, card4BC[0].border);
- borders3.splice(2, 1, cardVirtualBC[0].border);
+ 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);
- numbers3.splice(0, 1, carte1.number);
- numbers3.splice(1, 1, card4BC[0].number);
- numbers3.splice(2, 1, cardVirtualBC[0].number);
+ 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);
+ 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);
+
+
+
+ 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);
+
+ 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);
+
+ 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);
+
+
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
//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]) {
+ 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.setHS1 = self.setHS1 + 1;
+ self.setHS2 = self.setHS2 + 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]) {
+ 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.setHS1 = self.setHS1 + 1;
+ self.setHS2 = self.setHS2 + 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]) {
+ 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;
+ }
+ }
+ }
+ }
+
+
+
+ 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.setHS1 = self.setHS1 + 1;
+ 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;
}
}
}
@@ -2174,13 +2483,528 @@ var Game = {
}
}
- this.$nbSetsHS1.html(self.setHS1);
+ this.$nbSetsHS2.html(self.setHS2);
},
+ existingHyperSet3: 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 colors4 = [];
+ var shapes4 =[];
+ var fills4= [];
+ var borders4= [];
+ var numbers4= [];
+ var colors5 = [];
+ var shapes5 =[];
+ var fills5= [];
+ var borders5= [];
+ var numbers5= [];
+ var colors6 = [];
+ var shapes6 =[];
+ var fills6= [];
+ var borders6= [];
+ var numbers6= [];
+ var colors7 = [];
+ var shapes7 =[];
+ var fills7= [];
+ var borders7= [];
+ var numbers7= [];
+ var colors8 = [];
+ var shapes8 =[];
+ var fills8= [];
+ var borders8= [];
+ var numbers8= [];
+
+
+
+ var self = this;
+ var cartes = self.cardsHS3;
+ var cartes1 = cartes;
+ var cartes2 = cartes;
+ var cartes3 = cartes;
+ var cartes4 = cartes;
+
+
+ var carte1, carte3, carte4, carte5;
+ 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 = [];
+
+ 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.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-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];
+
+ card6ABC = this.generateVirtualCard44(tCardsABC);
+ card6ABD = this.generateVirtualCard44(tCardsABD);
+ card6ABE = this.generateVirtualCard44(tCardsABE);
+ card6ACD = this.generateVirtualCard44(tCardsACD);
+ card6ACE = this.generateVirtualCard44(tCardsACE);
+ card6BCD = this.generateVirtualCard44(tCardsBCD);
+ card6BCE = this.generateVirtualCard44(tCardsBCE);
+ card6CDE = this.generateVirtualCard44(tCardsCDE);
+
+ colors1.splice(0, 1, carte4.color);
+ colors1.splice(1, 1, carte5.color);
+ colors1.splice(2, 1, card6ABC[0].color);
+ colors1.splice(3, 1, cardVirtualABC[0].color);
+
+ shapes1.splice(0, 1, carte4.shape);
+ shapes1.splice(1, 1, carte5.shape);
+ shapes1.splice(2, 1, card6ABC[0].shape);
+ shapes1.splice(3, 1, cardVirtualABC[0].shape);
+
+ fills1.splice(0, 1, carte4.fill);
+ fills1.splice(1, 1, carte5.fill);
+ fills1.splice(2, 1, card6ABC[0].fill);
+ fills1.splice(3, 1, cardVirtualABC[0].fill);
+
+ borders1.splice(0, 1, carte4.border);
+ borders1.splice(1, 1, carte5.border);
+ borders1.splice(2, 1, card6ABC[0].border);
+ borders1.splice(3, 1, cardVirtualABC[0].border);
+
+ numbers1.splice(0, 1, carte4.number);
+ numbers1.splice(1, 1, carte5.number);
+ numbers1.splice(2, 1, card6ABC[0].number);
+ numbers1.splice(3, 1, cardVirtualABC[0].number);
+
+
+ colors2.splice(0, 1, carte3.color);
+ colors1.splice(1, 1, carte5.color);
+ colors2.splice(2, 1, card6ABD[0].color);
+ colors2.splice(3, 1, cardVirtualABD[0].color);
+
+ shapes2.splice(0, 1, carte3.shape);
+ shapes1.splice(1, 1, carte5.shape);
+ shapes2.splice(2, 1, card6ABD[0].shape);
+ shapes2.splice(3, 1, cardVirtualABD[0].shape);
+
+ 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);
+
+ borders2.splice(0, 1, carte3.border);
+ borders2.splice(1, 1, carte5.border);
+ borders2.splice(2, 1, card6ABD[0].border);
+ borders2.splice(3, 1, cardVirtualABD[0].border);
+
+ 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);
+
+
+ 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);
+
+ 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);
+
+ 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);
+
+ borders3.splice(0, 1, carte3.border);
+ borders3.splice(1, 1, carte4.border);
+ borders3.splice(2, 1, card6ABE[0].border);
+ borders3.splice(3, 1, cardVirtualABE[0].border);
+
+ 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);
+
+
+
+
+ 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);
+
+ 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);
+
+ borders4.splice(0, 1, carte2.border);
+ borders4.splice(1, 1, carte5.border);
+ borders4.splice(2, 1, card6ACD[0].border);
+ borders4.splice(3, 1, cardVirtualACD[0].border);
+
+ 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);
+
+
+ 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);
+
+ 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);
+
+ borders5.splice(0, 1, carte2.border);
+ borders5.splice(1, 1, carte4.border);
+ borders5.splice(2, 1, card6ACE[0].border);
+ borders5.splice(3, 1, cardVirtualACE[0].border);
+
+ 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);
+
+
+ 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);
+
+ 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);
+
+ 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);
+
+ borders6.splice(0, 1, carte1.border);
+ borders6.splice(1, 1, carte5.border);
+ borders6.splice(2, 1, card6BCD[0].border);
+ borders6.splice(3, 1, cardVirtualBCD[0].border);
+
+ 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);
+
+
+
+ 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);
+
+ 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);
+
+ borders7.splice(0, 1, carte1.border);
+ borders7.splice(1, 1, carte4.border);
+ borders7.splice(2, 1, card6BCE[0].border);
+ borders7.splice(3, 1, cardVirtualBCE[0].border);
+
+ 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);
+ 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);
+
+ 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);
+
+ 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);
+
+ borders8.splice(0, 1, carte1.border);
+ borders8.splice(1, 1, carte2.border);
+ borders8.splice(2, 1, card6CDE[0].border);
+ borders8.splice(3, 1, cardVirtualCDE[0].border);
+
+ 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);
+
+ //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.cardsHS3.length; a++) {
+ if (shapes1[2] !== undefined && colors1[2] !== undefined && fills1[2] !== undefined && borders1[2] !== undefined && numbers1[2] !== undefined) {
+ if (shapes1[3] !== undefined && colors1[3] !== undefined && fills1[3] !== undefined && borders1[3] !== undefined && numbers1[3] !== undefined) {
+ if (shapes1[2] === shapesall[a] && colors1[2] === colorsall[a] && fills1[2] === fillsall[a] && borders1[2] === bordersall[a] && numbers1[2] === numbersall[a]) {
+ //console.log('ab');
+ //console.log(shapes1, colors1, fills1, borders1, numbers1);
+ //console.log(carte1);
+ //console.log(carte2);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes2[2] !== undefined && colors2[2] !== undefined && fills2[2] !== undefined && borders2[2] !== undefined && numbers2[2] !== undefined) {
+ if (shapes2[3] !== undefined && colors2[3] !== undefined && fills2[3] !== undefined && borders2[3] !== undefined && numbers2[3] !== undefined) {
+ if (shapes2[2] === shapesall[a] && colors2[2] === colorsall[a] && fills2[2] === fillsall[a] && borders2[2] === bordersall[a] && numbers2[2] === numbersall[a]) {
+ //console.log('ac');
+ //console.log(shapes2, colors2, fills2, borders2, numbers2);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes3[2] !== undefined && colors3[2] !== undefined && fills3[2] !== undefined && borders3[2] !== undefined && numbers3[2] !== undefined) {
+ if (shapes3[3] !== undefined && colors3[3] !== undefined && fills3[3] !== undefined && borders3[3] !== undefined && numbers3[3] !== undefined) {
+ if (shapes3[2] === shapesall[a] && colors3[2] === colorsall[a] && fills3[2] === fillsall[a] && borders3[2] === bordersall[a] && numbers3[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+
+
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes4[2] !== undefined && colors4[2] !== undefined && fills4[2] !== undefined && borders4[2] !== undefined && numbers4[2] !== undefined) {
+ if (shapes4[3] !== undefined && colors4[3] !== undefined && fills4[3] !== undefined && borders4[3] !== undefined && numbers4[3] !== undefined) {
+ if (shapes4[2] === shapesall[a] && colors4[2] === colorsall[a] && fills4[2] === fillsall[a] && borders4[2] === bordersall[a] && numbers4[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes5[2] !== undefined && colors5[2] !== undefined && fills5[2] !== undefined && borders5[2] !== undefined && numbers5[2] !== undefined) {
+ if (shapes5[3] !== undefined && colors5[3] !== undefined && fills5[3] !== undefined && borders5[3] !== undefined && numbers5[3] !== undefined) {
+ if (shapes5[2] === shapesall[a] && colors5[2] === colorsall[a] && fills5[2] === fillsall[a] && borders5[2] === bordersall[a] && numbers5[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes6[2] !== undefined && colors6[2] !== undefined && fills6[2] !== undefined && borders6[2] !== undefined && numbers6[2] !== undefined) {
+ if (shapes6[3] !== undefined && colors6[3] !== undefined && fills6[3] !== undefined && borders6[3] !== undefined && numbers6[3] !== undefined) {
+ if (shapes6[2] === shapesall[a] && colors6[2] === colorsall[a] && fills6[2] === fillsall[a] && borders6[2] === bordersall[a] && numbers6[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes7[2] !== undefined && colors7[2] !== undefined && fills7[2] !== undefined && borders7[2] !== undefined && numbers7[2] !== undefined) {
+ if (shapes7[3] !== undefined && colors7[3] !== undefined && fills7[3] !== undefined && borders7[3] !== undefined && numbers7[3] !== undefined) {
+ if (shapes7[2] === shapesall[a] && colors7[2] === colorsall[a] && fills7[2] === fillsall[a]&& borders7[2] === bordersall[a] && numbers7[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+
+ for (a = k + 1; a < self.cardsHS3.length; a++) {
+ if (shapes8[2] !== undefined && colors8[2] !== undefined && fills8[2] !== undefined && borders8[2] !== undefined && numbers8[2] !== undefined) {
+ if (shapes8[3] !== undefined && colors8[3] !== undefined && fills8[3] !== undefined && borders8[3] !== undefined && numbers8[3] !== undefined) {
+ if (shapes8[2] === shapesall[a] && colors8[2] === colorsall[a] && fills8[2] === fillsall[a] && borders8[2] === bordersall[a] && numbers8[2] === numbersall[a]) {
+ //console.log('bc');
+ //console.log(shapes3, colors3, fills3, borders3, numbers3);
+ self.setHS3 = self.setHS3 + 1;
+ }
+ }
+ }
+ }
+
+
+ }
+ }
+ }
+ }
+ }
+
+ this.$nbSetsHS3.html(self.setHS3);
+ },
+
+
@@ -2409,9 +3233,52 @@ var Game = {
self.silentSubmissionHS2();
}
});
+
},
+ setCardListenersHS3: function() {
+ var self = this;
+
+ // what happens when a card is clicked:
+ this.$boardHS3.on('click', '.card', function(e) {
+ e.stopImmediatePropagation();
+ var card = e.currentTarget;
+
+ // if card is new, add it, otherwise remove it
+ var ids = $.map(self.selectedHS3, function(el) { return $(el).data("id");});
+ if (ids.indexOf($(card).data('id')) >= 0) {
+ self.deselectCard(self.selectedHS3,card);
+ } else {
+ self.selectCard6(self.selectedHS3,card);
+ }
+
+ if (self.selectedHS3.length === 6) {
+ self.silentSubmissionHS3();
+ }
+ });
+ },
+ setCardListenersHS4: function() {
+ var self = this;
+
+ // what happens when a card is clicked:
+ this.$boardHS4.on('click', '.card', function(e) {
+ e.stopImmediatePropagation();
+ var card = e.currentTarget;
+
+ // if card is new, add it, otherwise remove it
+ var ids = $.map(self.selectedHS4, function(el) { return $(el).data("id");});
+ if (ids.indexOf($(card).data('id')) >= 0) {
+ self.deselectCard(self.selectedHS4,card);
+ } else {
+ self.selectCard8(self.selectedHS4,card);
+ }
+
+ if (self.selectedHS4.length === 8) {
+ self.silentSubmissionHS4();
+ }
+ });
+ },
@@ -2450,7 +3317,14 @@ var Game = {
}
},
+ selectCard8: function(selectedCard, card) {
+ if (selectedCard.length < 8) {
+ $(card).addClass('selected');
+ selectedCard.push(card);
+
+ }
+ },
deselectCard: function(selectedCards,card) {
@@ -3869,6 +4743,143 @@ var Game = {
},
+ generateVirtualCard55: 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;});
+ }
+ var colorsSet = new Set(colors2);
+ var shapesSet = new Set(shapes2);
+ var fillsSet = new Set(fills2);
+ var bordersSet = new Set(borders2);
+ var numbersSet = new Set(numbers2);
+
+ if (colors2[0] === colors2[1] && colors2[0] === colors2[2] && colors2[0] === colors2[3]) {
+ colors2.push(colors2[0]);
+
+ }else {
+ if(colorsSet.has('green') && colorsSet.has('red') && colorsSet.has('lightblue') && colorsSet.has('yellow')){
+ colors2.push('purple');
+ }
+ if(colorsSet.has('green') && colorsSet.has('red') && colorsSet.has('yellow') && colorsSet.has('purple')){
+ colors2.push('lightblue');
+ }
+ if(colorsSet.has('green') && colorsSet.has('yellow') && colorsSet.has('lightblue')&& colorsSet.has('purple')){
+ colors2.push('red');
+ }
+ if(colorsSet.has('green') && colorsSet.has('red') && colorsSet.has('lightblue')&& colorsSet.has('purple')){
+ colors2.push('yellow');
+ }
+ if(colorsSet.has('yellow') && colorsSet.has('red') && colorsSet.has('lightblue')&& colorsSet.has('purple')){
+ colors2.push('green');
+ }
+
+ }
+
+ if (shapes2[0] === shapes2 [1] && shapes2[0] === shapes2 [2]&& shapes2[0] === shapes2 [3]) {
+ shapes2.push(shapes2[0]);
+ } else {
+ if(shapesSet.has('diamond') && shapesSet.has('rectangle') && shapesSet.has('triangle') && shapesSet.has('oval')){
+ shapes2.push('wave');
+ }
+ if(shapesSet.has('wave') && shapesSet.has('rectangle') && shapesSet.has('triangle') && shapesSet.has('oval')){
+ shapes2.push('diamond');
+ }
+ if(shapesSet.has('diamond') && shapesSet.has('wave') && shapesSet.has('triangle')&& shapesSet.has('oval')){
+ shapes2.push('rectangle');
+ }
+ if(shapesSet.has('diamond') && shapesSet.has('rectangle') && shapesSet.has('wave')&& shapesSet.has('oval')){
+ shapes2.push('triangle');
+ }
+ if(shapesSet.has('diamond') && shapesSet.has('rectangle') && shapesSet.has('triangle')&& shapesSet.has('wave')){
+ shapes2.push('oval');
+ }
+ }
+
+ if (fills2[0] === fills2 [1] && fills2[0] === fills2 [2]&& fills2[0] === fills2 [3]) {
+ fills2.push(fills2[0]);
+ } else {
+ if(fillsSet.has('open') && fillsSet.has('solid') && fillsSet.has('stripped') && fillsSet.has('quadrillage')){
+ fills2.push('pointille');
+ }
+ if(fillsSet.has('pointille') && fillsSet.has('solid') && fillsSet.has('stripped') && fillsSet.has('quadrillage')){
+ fills2.push('open');
+ }
+ if(fillsSet.has('open') && fillsSet.has('pointille') && fillsSet.has('stripped')&& fillsSet.has('quadrillage')){
+ fills2.push('solid');
+ }
+ if(fillsSet.has('open') && fillsSet.has('solid') && fillsSet.has('pointille')&& fillsSet.has('quadrillage')){
+ fills2.push('stripped');
+ }
+ if(fillsSet.has('open') && fillsSet.has('solid') && fillsSet.has('stripped')&& fillsSet.has('pointille')){
+ fills2.push('quadrillage');
+ }
+ }
+
+
+ if (borders2[0] === borders2 [1] && borders2[0] === borders2 [2]&& borders2[0] === borders2 [3]) {
+ borders2.push(borders2[0]);
+ }else {
+ if (bordersSet.has('plein') && bordersSet.has('point') && bordersSet.has('rond') && bordersSet.has('zigzag')) {
+ borders2.push('hachure');
+ }
+ if (bordersSet.has('hachure') && bordersSet.has('point') && bordersSet.has('rond') && bordersSet.has('zigzag')) {
+ borders2.push('plein');
+ }
+ if (bordersSet.has('plein') && bordersSet.has('hachure') && bordersSet.has('rond') && bordersSet.has('zigzag')) {
+ borders2.push('point');
+ }
+ if (bordersSet.has('plein') && bordersSet.has('point') && bordersSet.has('hachure') && bordersSet.has('zigzag')) {
+ borders2.push('rond');
+ }
+ if (bordersSet.has('plein') && bordersSet.has('point') && bordersSet.has('rond') && bordersSet.has('hachure')) {
+ borders2.push('zigzag');
+ }
+ }
+
+ if (numbers2[0] === numbers2 [1] && numbers2[0] === numbers2 [2]&& numbers2[0] === numbers2 [3]) {
+ numbers2.push(numbers2[0]);
+ }else {
+ if (numbersSet.has(1) && numbersSet.has(2) && numbersSet.has(3) && numbersSet.has(4)) {
+ numbers2.push(5);
+ }
+ if (numbersSet.has(5) && numbersSet.has(2) && numbersSet.has(3) && numbersSet.has(4)) {
+ numbers2.push(1);
+ }
+ if (numbersSet.has(1) && numbersSet.has(5) && numbersSet.has(3) && numbersSet.has(4)) {
+ numbers2.push(2);
+ }
+ if (numbersSet.has(1) && numbersSet.has(2) && numbersSet.has(5) && numbersSet.has(4)) {
+ numbers2.push(3);
+ }
+ if (numbersSet.has(1) && numbersSet.has(2) && numbersSet.has(3) && numbersSet.has(5)) {
+ numbers2.push(4);
+ }
+ }
+
+ var card5 = [];
+ card5.push({
+ shape: shapes2[4],
+ fill: fills2[4],
+ color: colors2[4],
+ border: borders2[4],
+ number: numbers2[4]
+ });
+
+ return card5;
+ },
+
+
comparaison2Carte4:function (carte1, carte2){
@@ -3889,7 +4900,7 @@ var Game = {
},
comparaison2Carte5:function (carte1, carte2) {
if( carte1[0].color !== undefined && carte1[0].border!== undefined && carte1[0].shape !== undefined && carte1[0].fill !== undefined && carte1[0].number !== undefined && carte2[0].color !== undefined && carte2[0].border !== undefined && carte2[0].shape !== undefined && carte2[0].fill !== undefined && carte2[0].number !== undefined){
- return carte1[0].color === carte2[0].color && carte1[0].shape === carte2[0].shape && carte1[0].number === carte2[0].number && carte1[0].fill === carte2[0].fill ;
+ return carte1[0].color === carte2[0].color && carte1[0].shape === carte2[0].shape && carte1[0].number === carte2[0].number && carte1[0].fill === carte2[0].fill && carte1[0].border === carte2[0].border;
}
},
@@ -4203,6 +5214,166 @@ var Game = {
},
+ validateHyperSet3: function() {
+
+
+ var carteABC = [];
+ var carteDEF = [];
+
+ var carteABD = [];
+ var carteCEF = [];
+
+ var carteABE = [];
+ var carteCDF = [];
+
+ var carteABF = [];
+ var carteCDE = [];
+
+ var carteACD = [];
+ var carteBEF = [];
+
+ var carteACE = [];
+ var carteBDF = [];
+
+ var carteACF = [];
+ var carteBDE = [];
+
+ var carteADE = [];
+ var carteBCF = [];
+
+ var carteADF = [];
+ var carteBCE = [];
+
+ var carteAEF = [];
+ var carteBCD = [];
+
+
+ carteABC.splice(0, 1, this.selectedHS3[0]);
+ carteABC.splice(1, 1, this.selectedHS3[1]);
+ carteABC.splice(2, 1, this.selectedHS3[2]);
+ carteDEF.splice(0, 1, this.selectedHS3[3]);
+ carteDEF.splice(1, 1, this.selectedHS3[4]);
+ carteDEF.splice(2, 1, this.selectedHS3[5]);
+
+ carteABD.splice(0, 1, this.selectedHS3[0]);
+ carteABD.splice(1, 1, this.selectedHS3[1]);
+ carteABD.splice(2, 1, this.selectedHS3[3]);
+ carteCEF.splice(0, 1, this.selectedHS3[2]);
+ carteCEF.splice(1, 1, this.selectedHS3[4]);
+ carteCEF.splice(2, 1, this.selectedHS3[5]);
+
+ carteABE.splice(0, 1, this.selectedHS3[0]);
+ carteABE.splice(1, 1, this.selectedHS3[1]);
+ carteABE.splice(2, 1, this.selectedHS3[4]);
+ carteCDF.splice(0, 1, this.selectedHS3[2]);
+ carteCDF.splice(1, 1, this.selectedHS3[3]);
+ carteCDF.splice(2, 1, this.selectedHS3[5]);
+
+ carteABF.splice(0, 1, this.selectedHS3[0]);
+ carteABF.splice(1, 1, this.selectedHS3[1]);
+ carteABF.splice(2, 1, this.selectedHS3[5]);
+ carteCDE.splice(0, 1, this.selectedHS3[2]);
+ carteCDE.splice(1, 1, this.selectedHS3[3]);
+ carteCDE.splice(2, 1, this.selectedHS3[4]);
+
+ carteACD.splice(0, 1, this.selectedHS3[0]);
+ carteACD.splice(1, 1, this.selectedHS3[2]);
+ carteACD.splice(2, 1, this.selectedHS3[3]);
+ carteBEF.splice(0, 1, this.selectedHS3[1]);
+ carteBEF.splice(1, 1, this.selectedHS3[4]);
+ carteBEF.splice(2, 1, this.selectedHS3[5]);
+
+ carteACE.splice(0, 1, this.selectedHS3[0]);
+ carteACE.splice(1, 1, this.selectedHS3[2]);
+ carteACE.splice(2, 1, this.selectedHS3[4]);
+ carteBDF.splice(0, 1, this.selectedHS3[1]);
+ carteBDF.splice(1, 1, this.selectedHS3[3]);
+ carteBDF.splice(2, 1, this.selectedHS3[5]);
+
+ carteACF.splice(0, 1, this.selectedHS3[0]);
+ carteACF.splice(1, 1, this.selectedHS3[2]);
+ carteACF.splice(2, 1, this.selectedHS3[5]);
+ carteBDE.splice(0, 1, this.selectedHS3[1]);
+ carteBDE.splice(1, 1, this.selectedHS3[3]);
+ carteBDE.splice(2, 1, this.selectedHS3[4]);
+
+ carteADE.splice(0, 1, this.selectedHS3[0]);
+ carteADE.splice(1, 1, this.selectedHS3[3]);
+ carteADE.splice(2, 1, this.selectedHS3[4]);
+ carteBCF.splice(0, 1, this.selectedHS3[1]);
+ carteBCF.splice(1, 1, this.selectedHS3[2]);
+ carteBCF.splice(2, 1, this.selectedHS3[5]);
+
+ carteADF.splice(0, 1, this.selectedHS3[0]);
+ carteADF.splice(1, 1, this.selectedHS3[3]);
+ carteADF.splice(2, 1, this.selectedHS3[5]);
+ carteBCE.splice(0, 1, this.selectedHS3[1]);
+ carteBCE.splice(1, 1, this.selectedHS3[2]);
+ carteBCE.splice(2, 1, this.selectedHS3[4]);
+
+ carteAEF.splice(0, 1, this.selectedHS3[0]);
+ carteAEF.splice(1, 1, this.selectedHS3[4]);
+ carteAEF.splice(2, 1, this.selectedHS3[5]);
+ carteBCD.splice(0, 1, this.selectedHS3[1]);
+ carteBCD.splice(1, 1, this.selectedHS3[2]);
+ carteBCD.splice(2, 1, this.selectedHS3[3]);
+
+
+ var card3 = this.generateVirtualCard45(carteABC);
+ var card4 = this.generateVirtualCard45(carteDEF);
+ if (this.comparaison2Carte5(card3,card4)){
+ return true;
+ }
+
+ var card5 = this.generateVirtualCard45(carteABD);
+ var card6 = this.generateVirtualCard45(carteCEF);
+ if (this.comparaison2Carte5(card5,card6)){
+ return true;
+ }
+ var card7 = this.generateVirtualCard45(carteABE);
+ var card8 = this.generateVirtualCard45(carteCDF);
+ if (this.comparaison2Carte5(card7,card8)){
+ return true;
+ }
+ var card9 = this.generateVirtualCard45(carteABF);
+ var card10 = this.generateVirtualCard45(carteCDE);
+ if (this.comparaison2Carte5(card9,card10)){
+ return true;
+ }
+ var card11 = this.generateVirtualCard45(carteACD);
+ var card12 = this.generateVirtualCard45(carteBEF);
+ if (this.comparaison2Carte5(card11,card12)){
+ return true;
+ }
+ var card13 = this.generateVirtualCard45(carteACE);
+ var card14 = this.generateVirtualCard45(carteBDF);
+ if (this.comparaison2Carte5(card13,card14)){
+ return true;
+ }
+ var card15 = this.generateVirtualCard45(carteACF);
+ var card16 = this.generateVirtualCard45(carteBDE);
+ if (this.comparaison2Carte5(card15,card16)){
+ return true;
+ }
+ var card17 = this.generateVirtualCard45(carteADE);
+ var card18 = this.generateVirtualCard45(carteBCF);
+ if (this.comparaison2Carte5(card17,card18)){
+ return true;
+ }
+ var card19= this.generateVirtualCard45(carteADF);
+ var card20 = this.generateVirtualCard45(carteBCE);
+ if (this.comparaison2Carte5(card19,card20)){
+ return true;
+ }
+ var card21 = this.generateVirtualCard45(carteAEF);
+ var card22 = this.generateVirtualCard45(carteBCD);
+ if (this.comparaison2Carte5(card21,card22)){
+ return true;
+ }
+ return false;
+
+
+ },
@@ -4379,7 +5550,18 @@ var Game = {
this.submitSetHS2();
}
},
-
+ silentSubmissionHS3: function() {
+ var valid = this.validateHyperSet3();
+ if (valid) {
+ this.submitSetHS3();
+ }
+ },
+ silentSubmissionHS4: function() {
+ var valid = this.validateHyperSet4();
+ if (valid) {
+ this.submitSetHS4();
+ }
+ },
@@ -4678,9 +5860,9 @@ var Game = {
// to do - implement game complete check on server
if (!data.gameComplete) {
- //self.set0 = 0;
+ self.setHS2 = 0;
//self.updateCards(data);
- //self.existingSet0();
+ self.existingHyperSet2();
self.increaseScoreHS2();
} else {
self.gameWon();
@@ -4693,6 +5875,68 @@ var Game = {
this.clearSelections(this.selectedHS2);
},
+ submitSetHS3: function() {
+ var self = this;
+ var ids = $.map(self.selectedHS3, function(el) { return $(el).data("id");});
+
+
+ // ajax request to get initial set of cards
+ var newCardRequest = $.ajax({
+ url: 'set.php?action=submitHS3',
+ type: 'GET',
+ dataType: 'json',
+ success: function(data) {
+ self.clearCardsHS3(ids, data);
+
+ // to do - implement game complete check on server
+ if (!data.gameComplete) {
+ self.setHS3 = 0;
+ //self.updateCards(data);
+ //self.existingSet0();
+ self.increaseScoreHS3();
+ } else {
+ self.gameWon();
+ }
+ },
+ error: function() {
+ console.log(arguments);
+ }
+ });
+
+ this.clearSelections(this.selectedHS3);
+ },
+
+ submitSetHS4: function() {
+ var self = this;
+ var ids = $.map(self.selectedHS4, function(el) { return $(el).data("id");});
+
+
+ // ajax request to get initial set of cards
+ var newCardRequest = $.ajax({
+ url: 'set.php?action=submitHS4',
+ type: 'GET',
+ dataType: 'json',
+ success: function(data) {
+ self.clearCardsHS4(ids, data);
+
+ // to do - implement game complete check on server
+ if (!data.gameComplete) {
+ self.setHS4 = 0;
+ //self.updateCards(data);
+ //self.existingSet0();
+ self.increaseScoreHS4();
+ } else {
+ self.gameWon();
+ }
+ },
+ error: function() {
+ console.log(arguments);
+ }
+ });
+
+ this.clearSelections(this.selectedHS4);
+ },
+
@@ -4944,8 +6188,7 @@ var Game = {
cardIds = $.map(self.cardsHS2, function(card) { return card.id; });
}
else{
- self.cardsHS1.splice(location, 1);
-
+ self.cardsHS2.splice(location, 1);
}
}
});
@@ -4955,6 +6198,53 @@ var Game = {
}
},
+ clearCardsHS3: function(ids,data) {
+ var self = this;
+ this.selectedHS3 = [];
+ this.$boardHS3.empty();
+ var cardIds = $.map(self.cardsHS3, function(card) { return card.id; });
+ $.each(ids, function(idx, id) {
+ var location = cardIds.indexOf(id);
+ if (location > -1) {
+ cardIds.splice(location, 1);
+ if(data[idx] != null){
+ self.remplacerCarte(location,data[idx],self.cardsHS3);
+ cardIds = $.map(self.cardsHS3, function(card) { return card.id; });
+ }
+ else{
+ self.cardsHS3.splice(location, 1);
+ }
+ }
+ });
+ this.displayCardsHS3();
+ if(self.cardsHS3.length === 0){
+ alert("you won!");
+ }
+ },
+
+ clearCardsHS4: function(ids,data) {
+ var self = this;
+ this.selectedHS4 = [];
+ this.$boardHS4.empty();
+ var cardIds = $.map(self.cardsHS4, function(card) { return card.id; });
+ $.each(ids, function(idx, id) {
+ var location = cardIds.indexOf(id);
+ if (location > -1) {
+ cardIds.splice(location, 1);
+ if(data[idx] != null){
+ self.remplacerCarte(location,data[idx],self.cardsHS4);
+ cardIds = $.map(self.cardsHS4, function(card) { return card.id; });
+ }
+ else{
+ self.cardsHS4.splice(location, 1);
+ }
+ }
+ });
+ this.displayCardsHS4();
+ if(self.cardsHS4.length === 0){
+ alert("you won!");
+ }
+ },
increaseScore0: function() {
@@ -4990,7 +6280,12 @@ var Game = {
increaseScoreHS2: function() {
this.$scoreHS2.html(++this.scoreHS2);
},
-
+ increaseScoreHS3: function() {
+ this.$scoreHS3.html(++this.scoreHS3);
+ },
+ increaseScoreHS4: function() {
+ this.$scoreHS4.html(++this.scoreHS4);
+ },
startRound: function() {
// todo