compteur HS 3x3 3x4 4x4

master
readhame 5 years ago
parent d4d0a5338f
commit 67fa9bfc5d

@ -126,7 +126,11 @@
<workItem from="1594896282228" duration="4161000" />
<workItem from="1594923234569" duration="65000" />
<workItem from="1594923470651" duration="68000" />
<workItem from="1594981177567" duration="6119000" />
<workItem from="1594981177567" duration="11123000" />
<workItem from="1595002939806" duration="4983000" />
<workItem from="1595241049078" duration="8933000" />
<workItem from="1595252250296" duration="15000" />
<workItem from="1595260179440" duration="1355000" />
</task>
<servers />
</component>
@ -166,22 +170,22 @@
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="337" y="75" key="SettingsEditor/0.0.1920.1040@0.0.1920.1040" timestamp="1593595043475" />
<state width="623" height="498" key="SwitcherDM" timestamp="1594813492846">
<state width="623" height="498" key="SwitcherDM" timestamp="1595243925469">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="623" height="498" key="SwitcherDM/0.0.1920.1040@0.0.1920.1040" timestamp="1594813492846" />
<state x="1136" y="344" key="com.intellij.ide.util.TipDialog" timestamp="1594981176093">
<state width="623" height="498" key="SwitcherDM/0.0.1920.1040@0.0.1920.1040" timestamp="1595243925469" />
<state x="1136" y="344" key="com.intellij.ide.util.TipDialog" timestamp="1595260187442">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="1136" y="344" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1594981176093" />
<state x="1136" y="344" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1595260187442" />
<state x="701" y="162" key="refactoring.ChangeSignatureDialog" timestamp="1593090265720">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="701" y="162" key="refactoring.ChangeSignatureDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1593090265720" />
<state x="616" y="240" key="run.anything.popup" timestamp="1593700659090">
<state x="616" y="240" key="run.anything.popup" timestamp="1595246369969">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="616" y="240" key="run.anything.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1593700659090" />
<state x="616" y="240" key="run.anything.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1595246369969" />
<state x="202" y="435" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1592990595770">
<screen x="0" y="0" width="1920" height="1040" />
</state>

@ -25,7 +25,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'deal') {
$_SESSION['deck2'] = new Deck($_GET['action']);
$_SESSION['game2'] = new Game($_SESSION['deck2']);
$game = $_SESSION['game2'];
echo json_encode($game->start(45));
echo json_encode($game->start(40));
} else if (isset($_GET['action']) && $_GET['action'] == 'deal3') {
$_SESSION['deck3'] = new Deck($_GET['action']);
@ -48,23 +48,23 @@ if (isset($_GET['action']) && $_GET['action'] == 'deal') {
$_SESSION['deckHS'] = new Deck($_GET['action']);
$_SESSION['gameHS'] = new Game($_SESSION['deckHS']);
$game = $_SESSION['gameHS'];
echo json_encode($game->start(40));
echo json_encode($game->start(12));
} else if (isset($_GET['action']) && $_GET['action'] == 'dealHS0') {
$_SESSION['deckHS0'] = new Deck($_GET['action']);
$_SESSION['gameHS0'] = new Game($_SESSION['deckHS0']);
$game = $_SESSION['gameHS0'];
echo json_encode($game->start(20));
echo json_encode($game->start(8));
}else if (isset($_GET['action']) && $_GET['action'] == 'dealHS1') {
$_SESSION['deckHS1'] = new Deck($_GET['action']);
$_SESSION['gameHS1'] = new Game($_SESSION['deckHS1']);
$game = $_SESSION['gameHS1'];
echo json_encode($game->start(55));
echo json_encode($game->start(15));
}else if (isset($_GET['action']) && $_GET['action'] == 'dealHS2') {
$_SESSION['deckHS2'] = new Deck($_GET['action']);
$_SESSION['gameHS2'] = new Game($_SESSION['deckHS2']);
$game = $_SESSION['gameHS2'];
echo json_encode($game->start(55));
echo json_encode($game->start(40));
}

@ -56,7 +56,7 @@ h1 {
}
.game-board2 {
margin-top: -1%;
margin-left: 15%;
margin-left: 17%;
height: 800px;
width: 780px;
transform: rotate(90deg);
@ -91,8 +91,8 @@ h1 {
}
.game-boardHS0 {
margin-top: 5%;
margin-left: 10%;
margin-top: -4%;
margin-left: 19%;
height: auto;
width: auto;
transform: rotate(90deg);
@ -100,7 +100,7 @@ h1 {
}
.game-boardHS {
margin-left: 17%;
margin-left: -1%;
height: 800px;
width: 800px;
transform: rotate(90deg);
@ -108,13 +108,21 @@ h1 {
}
.game-boardHS1 {
margin-top: -0.5%;
margin-left: 20%;
margin-left: 2%;
height: 800px;
width: 800px;
transform: rotate(90deg);
position: fixed;
}
.game-boardHS2 {
margin-top: -0.5%;
margin-left: 17%;
height: 800px;
width: 800px;
transform: rotate(90deg);
position: fixed;
}
.shape {
display: inline-block;

@ -202,7 +202,7 @@
<p>HyperSets found: <span data-display="scoreHS2" class="score">0</span></p>
<p>Number of HyperSets: <span data-display="nbSetsHS2" class="nbSets"></span></p>
<div class="game-boardHS1" data-display="game-boardHS2"></div>
<div class="game-boardHS2" data-display="game-boardHS2"></div>
</div>

@ -205,7 +205,7 @@ var Game = {
dataType: 'json',
success: function (data) {
self.cardsHS = data;
//self.existingHyperSet();
self.existingHyperSet();
self.displayCardsHS.call(self);
self.setCardListenersHS();
//self.setPageListenersHS();
@ -218,6 +218,7 @@ var Game = {
dataType: 'json',
success: function (data) {
self.cardsHS0 = data;
self.existingHyperSet0();
self.displayCardsHS0.call(self);
self.setCardListenersHS0();
//self.setPageListenersHS0();
@ -230,6 +231,7 @@ var Game = {
dataType: 'json',
success: function (data) {
self.cardsHS1 = data;
self.existingHyperSet1();
self.displayCardsHS1.call(self);
self.setCardListenersHS1();
//self.setPageListenersHS1();
@ -364,7 +366,7 @@ var Game = {
self.$board2.append(cardNode);
// display 4 cards per row
if ((index+1) % 5 === 0) {
if ((index+1) % 4 === 0) {
self.$board2.append($('<div>'));
}
@ -515,7 +517,7 @@ var Game = {
self.$boardHS.append(cardNode);
// display 4 cards per row
if ((index+1) % 4 === 0) {
if ((index+1) % 3 === 0) {
self.$boardHS.append($('<div>'));
}
@ -554,7 +556,7 @@ var Game = {
self.$boardHS0.append(cardNode);
// display 4 cards per row
if ((index+1) % 4 === 0) {
if ((index+1) % 2 === 0) {
self.$boardHS0.append($('<div>'));
}
@ -593,7 +595,7 @@ var Game = {
self.$boardHS1.append(cardNode);
// display 4 cards per row
if ((index+1) % 5 === 0) {
if ((index+1) % 3 === 0) {
self.$boardHS1.append($('<div>'));
}
@ -630,7 +632,7 @@ var Game = {
self.$boardHS2.append(cardNode);
// display 4 cards per row
if ((index+1) % 5 === 0) {
if ((index+1) % 4 === 0) {
self.$boardHS2.append($('<div>'));
}
@ -981,8 +983,8 @@ var Game = {
if (shapes1[3] !== undefined && colors1[3] !== undefined && fills1[3] !== undefined && numbers1[3] !== undefined) {
if (shapes1[3] === shapesall[a] && colors1[3] === colorsall[a] && fills1[3] === fillsall[a] && numbers1[3] === numbersall[a]) {
if (this.isSet4(shapes1) && this.isSet4(colors1) && this.isSet4(fills1) && this.isSet4(numbers1)) {
console.log('Set 4x4 : ');
console.log(shapes1, colors1, fills1, numbers1);
//console.log('Set 4x4 : ');
//console.log(shapes1, colors1, fills1, numbers1);
self.set2 = self.set2 + 1;
}
@ -1018,113 +1020,803 @@ var Game = {
*/
/*cardInListOfCardsHS : function (shapes, colors, fills, numbers){
/*existingHyperSet: function() {
var colors1 = [];
var shapes1 =[];
var fills1= [];
var numbers1= [];
var colors2 = [];
var shapes2 =[];
var fills2= [];
var numbers2= [];
var colors3 = [];
var shapes3 =[];
var fills3= [];
var numbers3= [];
var self = this;
var cartes = self.cardsHS;
var cartes1 = cartes;
var cartes2 = cartes;
var carte1, carte3;
var carte2;
var card4AB = [];
var card4AC = [];
var card4BC = [];
var cardVirtualAB = [];
var cardVirtualAC = [];
var cardVirtualBC = [];
var tCardsAB = [];
var tCardsAC = [];
var tCardsBC = [];
var colors14 = [];
var shapes14 =[];
var fills14= [];
var numbers14= [];
var colors24 = [];
var shapes24 =[];
var fills24= [];
var numbers24= [];
var colors34 = [];
var shapes34 =[];
var fills34= [];
var numbers34= [];
var i, j, a, k;
var colorsall= $.map(this.cardsHS, function(el) { return el.color;});
var shapesall = $.map(this.cardsHS, function(el) { return el.shape; });
var fillsall= $.map(this.cardsHS,function(el) { return el.fill; });
var numbersall = $.map(this.cardsHS, function(el) { return el.number;});
var a = 0;
for (a =0; a < this.cardsHS.length; a++) {
console.log(shapes, shapesall[a], colors, colorsall[a],fills,fillsall[a], numbers, numbersall[a]);
return shapes === shapesall[a] && colors === colorsall[a] && fills === fillsall[a] && numbers === numbersall[a];
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];
tCardsAB[0] = carte1;
tCardsAB[1]= carte2;
tCardsAC[0] = carte1;
tCardsAC[1]= carte3;
tCardsBC[0] = carte2;
tCardsBC[1]= carte3;
cardVirtualAB = this.generateVirtualCard34(tCardsAB);
cardVirtualAC = this.generateVirtualCard34(tCardsAC);
cardVirtualBC = this.generateVirtualCard34(tCardsBC);
tCardsAB[0]= carte3;
tCardsAB[1] = cardVirtualAB[0];
tCardsAC[0]= carte2;
tCardsAC[1] = cardVirtualAC[0];
tCardsBC[0]= carte1;
tCardsBC[1] = cardVirtualBC[0];
card4AB = this.generateVirtualCard34(tCardsAB);
card4AC = this.generateVirtualCard34(tCardsAC);
card4BC = this.generateVirtualCard34(tCardsBC);
colors14.splice(0, 1, card4AB[0].color);
shapes14.splice(1, 1, card4AB[0].shape);
fills14.splice(2, 1, card4AB[0].fill);
numbers14.splice(3, 1, card4AB[0].number);
colors24.splice(0, 1, card4AB[0].color);
shapes24.splice(1, 1, card4AB[0].shape);
fills24.splice(2, 1, card4AB[0].fill);
numbers24.splice(3, 1, card4AB[0].number);
colors34.splice(0, 1, card4AB[0].color);
shapes34.splice(1, 1, card4AB[0].shape);
fills34.splice(2, 1, card4AB[0].fill);
numbers34.splice(3, 1, card4AB[0].number);
colors1.splice(0, 1, carte1.color);
colors1.splice(1, 1, carte2.color);
colors1.splice(2, 1, cardVirtualAB[0].color);
shapes1.splice(0, 1, carte1.shape);
shapes1.splice(1, 1, carte2.shape);
shapes1.splice(2, 1, cardVirtualAB[0].shape);
fills1.splice(0, 1, carte1.fill);
fills1.splice(1, 1, carte2.fill);
fills1.splice(2, 1, cardVirtualAB[0].fill);
numbers1.splice(0, 1, carte1.number);
numbers1.splice(1, 1, carte2.number);
numbers1.splice(2, 1, cardVirtualAB[0].number);
colors2.splice(0, 1, carte1.color);
colors2.splice(1, 1, carte3.color);
colors2.splice(2, 1, cardVirtualAC[0].color);
shapes2.splice(0, 1, carte1.shape);
shapes2.splice(1, 1, carte3.shape);
shapes2.splice(2, 1, cardVirtualAC[0].shape);
fills2.splice(0, 1, carte1.fill);
fills2.splice(1, 1, carte3.fill);
fills2.splice(2, 1, cardVirtualAC[0].fill);
numbers2.splice(0, 1, carte1.number);
numbers2.splice(1, 1, carte3.number);
numbers2.splice(2, 1, cardVirtualAC[0].number);
colors3.splice(0, 1, carte2.color);
colors3.splice(1, 1, carte3.color);
colors3.splice(2, 1, cardVirtualBC[0].color);
shapes3.splice(0, 1, carte2.shape);
shapes3.splice(1, 1, carte3.shape);
shapes3.splice(2, 1, cardVirtualBC[0].shape);
fills3.splice(0, 1, carte2.fill);
fills3.splice(1, 1, carte3.fill);
fills3.splice(2, 1, cardVirtualBC[0].fill);
numbers3.splice(0, 1, carte2.number);
numbers3.splice(1, 1, carte3.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] )){}
a = k+1;
if ( colors14[0] !== undefined && shapes14[0] !== undefined && fills14[0] !== undefined && numbers14[0] !== undefined) {
if(shapes14[0] === shapesall[a] && colors14[0] === colorsall[a] && fills14[0] === fillsall[a] && numbers14[0] === numbersall[a]){
//console.log(carte1.color, carte1.fill, carte1.number, carte1.shape);
//console.log(carte2.color, carte2.fill, carte2.number, carte2.shape);
if( this.isSet(shapes1) && this.isSet(colors1) && this.isSet(fills1) && this.isSet(numbers1) ){
console.log('ab');
console.log(shapes1,colors1,fills1,numbers1);
console.log(colors14,shapes14,fills14,numbers14);
self.setHS = self.setHS + 1;
}
}
}
if (colors24[0] !== undefined && shapes24[0] !== undefined && fills24[0] !== undefined && numbers24[0] !== undefined) {
if(shapes24[0] === shapesall[a] && colors24[0] === colorsall[a] && fills24[0] === fillsall[a] && numbers24[0] === numbersall[a]){
if( this.isSet(shapes2) && this.isSet(colors2) && this.isSet(fills2) && this.isSet(numbers2) ) {
console.log('ac');
console.log(shapes2,colors2,fills2,numbers2);
console.log(colors14,shapes14,fills14,numbers14);
self.setHS = self.setHS + 1;
}
}
}
if (colors34[0] !== undefined && shapes34[0] !== undefined && fills34[0] !== undefined && numbers34[0] !== undefined) {
if(shapes34[0] === shapesall[a] && colors34[0] === colorsall[a] && fills34[0] === fillsall[a] && numbers34[0] === numbersall[a]){
if( this.isSet(shapes3) && this.isSet(colors3) && this.isSet(fills3) && this.isSet(numbers3) ) {
console.log('bc');
console.log(shapes3,colors3,fills3,numbers3);
console.log(colors14,shapes14,fills14,numbers14);
self.setHS = self.setHS + 1;
}
}
}
}
}
}
this.$nbSetsHS.html(self.setHS);
},
existingHyperSet: function() {
*/
existingHyperSet: function() {
var colors1 = [];
var shapes1 =[];
var fills1= [];
var numbers1= [];
var colors2 = [];
var shapes2 =[];
var fills2= [];
var numbers2= [];
var colors3 = [];
var shapes3 =[];
var fills3= [];
var numbers3= [];
var self = this;
var cartes = self.cardsHS;
var cartes1 = cartes;
var cartes2 = cartes;
var carte1, carte3;
var carte2;
var card4AB = [];
var card4AC = [];
var card4BC = [];
var cardVirtualAB = [];
var cardVirtualAC = [];
var cardVirtualBC = [];
var tCardsAB = [];
var tCardsAC = [];
var tCardsBC = [];
var i, j, a, k;
var colorsall= $.map(this.cardsHS, function(el) { return el.color;});
var shapesall = $.map(this.cardsHS, function(el) { return el.shape; });
var fillsall= $.map(this.cardsHS,function(el) { return el.fill; });
var numbersall = $.map(this.cardsHS, 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];
tCardsAB[0] = carte1;
tCardsAB[1]= carte2;
tCardsAC[0] = carte1;
tCardsAC[1]= carte3;
tCardsBC[0] = carte2;
tCardsBC[1]= carte3;
cardVirtualAB = this.generateVirtualCard34(tCardsAB);
cardVirtualAC = this.generateVirtualCard34(tCardsAC);
cardVirtualBC = this.generateVirtualCard34(tCardsBC);
tCardsAB[0]= carte3;
tCardsAB[1] = cardVirtualAB[0];
tCardsAC[0]= carte2;
tCardsAC[1] = cardVirtualAC[0];
tCardsBC[0]= carte1;
tCardsBC[1] = cardVirtualBC[0];
card4AB = this.generateVirtualCard34(tCardsAB);
card4AC = this.generateVirtualCard34(tCardsAC);
card4BC = this.generateVirtualCard34(tCardsBC);
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);
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);
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);
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.cardsHS.length; a++) {
if (shapes1[2] !== undefined && colors1[2] !== undefined && fills1[2] !== undefined && numbers1[2] !== undefined) {
if (shapes1[1] !== undefined && colors1[1] !== undefined && fills1[1] !== undefined && numbers1[1] !== undefined) {
if(shapes1[1] === shapesall[a] && colors1[1]=== colorsall[a] && fills1[1] === fillsall[a] && numbers1[1] === numbersall[a]){
//console.log('ab');
//console.log(shapes1, colors1, fills1, numbers1);
//console.log(carte1);
//console.log(carte2);
self.setHS = self.setHS + 1;
}
}
}
}
for (a = k+1; a < self.cardsHS.length; a++) {
if (shapes2[2] !== undefined && colors2[2] !== undefined && fills2[2] !== undefined && numbers2[2] !== undefined) {
if (shapes2[1] !== undefined && colors2[1] !== undefined && fills2[1] !== 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, numbers2);
self.setHS = self.setHS + 1;
}
}
}
}
for (a = k+1; a < self.cardsHS.length; a++) {
if (shapes3[2] !== undefined && colors3[2] !== undefined && fills3[2] !== undefined && numbers3[2] !== undefined) {
if (shapes3[1] !== undefined && colors3[1] !== undefined && fills3[1] !== undefined && numbers3[1] !== undefined) {
if(shapes3[1] === shapesall[a] && colors3[1]=== colorsall[a] && fills3[1] === fillsall[a] && numbers3[1] === numbersall[a]){
//console.log('bc');
//console.log(shapes3, colors3, fills3, numbers3);
self.setHS = self.setHS + 1;
}
}
}
}
}
}
}
this.$nbSetsHS.html(self.setHS);
},
existingHyperSet0: function() {
var colors1 = [];
var shapes1 =[];
var numbers1= [];
var colors2 = [];
var shapes2 =[];
var numbers2= [];
var colors3 = [];
var shapes3 =[];
var numbers3= [];
var self = this;
var cartes = self.cardsHS0;
var cartes1 = cartes;
var cartes2 = cartes;
var carte1, carte3;
var carte2;
var card4AB = [];
var card4AC = [];
var card4BC = [];
var cardVirtualAB = [];
var cardVirtualAC = [];
var cardVirtualBC = [];
var tCardsAB = [];
var tCardsAC = [];
var tCardsBC = [];
var i, j, a, k;
var colorsall= $.map(this.cardsHS0, function(el) { return el.color;});
var shapesall = $.map(this.cardsHS0, function(el) { return el.shape; });
var numbersall = $.map(this.cardsHS0, 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];
tCardsAB[0] = carte1;
tCardsAB[1]= carte2;
tCardsAC[0] = carte1;
tCardsAC[1]= carte3;
tCardsBC[0] = carte2;
tCardsBC[1]= carte3;
cardVirtualAB = this.generateVirtualCard33(tCardsAB);
cardVirtualAC = this.generateVirtualCard33(tCardsAC);
cardVirtualBC = this.generateVirtualCard33(tCardsBC);
tCardsAB[0]= carte3;
tCardsAB[1] = cardVirtualAB[0];
tCardsAC[0]= carte2;
tCardsAC[1] = cardVirtualAC[0];
tCardsBC[0]= carte1;
tCardsBC[1] = cardVirtualBC[0];
card4AB = this.generateVirtualCard33(tCardsAB);
card4AC = this.generateVirtualCard33(tCardsAC);
card4BC = this.generateVirtualCard33(tCardsBC);
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);
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);
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);
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.cardsHS0.length; a++) {
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);
self.setHS0 = self.setHS0 + 1;
}
}
}
}
for (a = k+1; a < self.cardsHS0.length; a++) {
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);
self.setHS0 = self.setHS0 + 1;
}
}
}
}
for (a = k+1; a < self.cardsHS0.length; a++) {
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);
self.setHS0 = self.setHS0 + 1;
}
}
}
}
}
}
}
this.$nbSetsHS0.html(self.setHS0);
},
existingHyperSet1: 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.cardsHS;
var cartes = self.cardsHS1;
var cartes1 = cartes;
var cartes2 = cartes;
var carte1, carte3;
var carte2;
var card4 = [];
var cardVirtual = [];
var tCards = [];
var card4AB = [];
var card4AC = [];
var card4BC = [];
var cardVirtualAB = [];
var cardVirtualAC = [];
var cardVirtualBC = [];
var tCardsAB = [];
var tCardsAC = [];
var tCardsBC = [];
var i, j, a, k;
var colorsall= $.map(this.cardsHS, function(el) { return el.color;});
var shapesall = $.map(this.cardsHS, function(el) { return el.shape; });
var fillsall= $.map(this.cardsHS,function(el) { return el.fill; });
var numbersall = $.map(this.cardsHS, function(el) { return el.number;});
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-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;
tCardsAB[0] = carte1;
tCardsAB[1]= carte2;
tCardsAC[0] = carte1;
tCardsAC[1]= carte3;
tCardsBC[0] = carte2;
tCardsBC[1]= carte3;
cardVirtual = this.generateVirtualCard34(tCards);
cardVirtualAB = this.generateVirtualCard35(tCardsAB);
cardVirtualAC = this.generateVirtualCard35(tCardsAC);
cardVirtualBC = this.generateVirtualCard35(tCardsBC);
tCards[0]= carte3;
tCards[1] = cardVirtual[0];
card4 = this.generateVirtualCard34(tCards);
tCardsAB[0]= carte3;
tCardsAB[1] = cardVirtualAB[0];
tCardsAC[0]= carte2;
tCardsAC[1] = cardVirtualAC[0];
tCardsBC[0]= carte1;
tCardsBC[1] = cardVirtualBC[0];
card4AB = this.generateVirtualCard35(tCardsAB);
card4AC = this.generateVirtualCard35(tCardsAC);
card4BC = this.generateVirtualCard35(tCardsBC);
colors1.splice(0, 1, carte3.color);
colors1.splice(1, 1, card4[0].color);
colors1.splice(2, 1, cardVirtual[0].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, card4[0].shape);
shapes1.splice(2, 1, cardVirtual[0].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, card4[0].fill);
fills1.splice(2, 1, cardVirtual[0].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, card4[0].number);
numbers1.splice(2, 1, cardVirtual[0].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.cardsHS.length; a++) {
if (shapes1[2] !== undefined && colors1[2] !== undefined && fills1[2] !== undefined && numbers1[2] !== undefined) {
if (shapes1[1] !== undefined && colors1[1] !== undefined && fills1[1] !== undefined && numbers1[1] !== undefined) {
if(this.cardInListOfCardsHS(shapes1[1],colors1[1],fills1[1],numbers1[1] )){
console.log(this.cardInListOfCardsHS(shapes1[1],colors1[1],fills1[1],numbers1[1] ));
self.setHS = self.setHS + 1;
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.$nbSetsHS.html(self.setHS);
this.$nbSetsHS1.html(self.setHS1);
},
*/
@ -2983,9 +3675,9 @@ var Game = {
// to do - implement game complete check on server
if (!data.gameComplete) {
//self.set0 = 0;
self.setHS = 0;
//self.updateCards(data);
//self.existingSet0();
self.existingHyperSet();
self.increaseScoreHS();
} else {
self.gameWon();
@ -3015,9 +3707,9 @@ var Game = {
// to do - implement game complete check on server
if (!data.gameComplete) {
//self.set0 = 0;
self.setHS0 = 0;
//self.updateCards(data);
//self.existingSet0();
self.existingHyperSet0();
self.increaseScoreHS0();
} else {
self.gameWon();
@ -3046,9 +3738,9 @@ var Game = {
// to do - implement game complete check on server
if (!data.gameComplete) {
//self.set0 = 0;
self.setHS1 = 0;
//self.updateCards(data);
//self.existingSet0();
self.existingHyperSet1();
self.increaseScoreHS1();
} else {
self.gameWon();

Loading…
Cancel
Save