Ajout test des Sets normaux
continuous-integration/drone/push Build is passing Details

pull/59/head^2
Aurian JAULT 2 years ago
parent 4dc364597f
commit 63cbca8fc1

@ -67,7 +67,6 @@ function numberOfSets3(deck){
for(j=i+1;j<deck.length-1;j++){ for(j=i+1;j<deck.length-1;j++){
for(k=j+1;k<deck.length;k++){ for(k=j+1;k<deck.length;k++){
if(isSet([deck[i],deck[j],deck[k]])){ if(isSet([deck[i],deck[j],deck[k]])){
console.log(deck[i],deck[j],deck[k])
res += 1 res += 1
} }
} }
@ -82,8 +81,7 @@ function numberOfSets4(deck){
for(j = i+1 ; j < deck.length - 2; j++){ for(j = i+1 ; j < deck.length - 2; j++){
for(k = j+1 ; k < deck.length - 1 ; k++){ for(k = j+1 ; k < deck.length - 1 ; k++){
for(l = k + 1 ; l < deck.length;l++){ for(l = k + 1 ; l < deck.length;l++){
if(isSet([deck[i],deck[j],deck[k]])){ if(isSet([deck[i],deck[j],deck[k],deck[l]])){
console.log(deck[i],deck[j],deck[k],deck[l])
res += 1 res += 1
} }
} }
@ -100,8 +98,7 @@ function numberOfSets5(deck){
for(k = j+1 ; k < deck.length - 2 ; k++){ for(k = j+1 ; k < deck.length - 2 ; k++){
for(l = k + 1 ; l < deck.length - 1;l++){ for(l = k + 1 ; l < deck.length - 1;l++){
for(m = l + 1; m <deck.length;m++){ for(m = l + 1; m <deck.length;m++){
if(isSet([deck[i],deck[j],deck[k]])){ if(isSet([deck[i],deck[j],deck[k],deck[l],deck[m]])){
console.log(deck[i],deck[j],deck[k],deck[l],deck[m])
res += 1 res += 1
} }
} }

@ -0,0 +1,45 @@
console.log("TEST FOR ISSET")
let card1 = new Card5("bleu","1","rond","remplis","plein")
let card2 = new Card5("bleu","2","rond","remplis","plein")
let card3 = new Card5("bleu","3","rond","remplis","plein")
let card4 = new Card5("bleu","4","rond","remplis","plein")
let card5 = new Card5("bleu","5","rond","remplis","plein")
let card6 = new Card5("vert","6","carre","vide","tapis")
let realSet = [card1,card2,card3,card4,card5]
let unRealSet = [card2,card3,card4,card5,card6]
console.group("FOR SET OF 5")
console.log("Number of Sets -> 1")
console.assert(numberOfSets5(realSet)==1)
console.log("Number of Sets -> 0")
console.assert(numberOfSets5(unRealSet)==0)
console.groupEnd()
card1 = new Card4WithoutColor("1","rond","plein","tapis")
card2 = new Card4WithoutColor("2","rond","plein","tapis")
card3 = new Card4WithoutColor("3","rond","plein","tapis")
card4 = new Card4WithoutColor("4","rond","plein","tapis")
card5 = new Card4WithoutColor("4","carre","vide","plein")
realSet = [card1,card2,card3,card4]
unRealSet = [card2,card3,card4,card5]
console.group("FOR SET OF 4")
console.log("Number of Sets -> 1")
console.assert(numberOfSets4(realSet)==1)
console.log("Number of Sets -> 0")
console.assert(numberOfSets4(unRealSet)==0)
console.groupEnd()
Loading…
Cancel
Save