@ -15,6 +15,14 @@ var allMode = ["Match à Point", "Mode Timer", "Infini", "Bac"]; // Défini tout
var allDimension = [ "4 * 3" , "3 * 3" , "3 * 2" , "2 * 2" ] ; // Défini toutes les dimensions que les cartes peuvent avoir
var allDimension = [ "4 * 3" , "3 * 3" , "3 * 2" , "2 * 2" ] ; // Défini toutes les dimensions que les cartes peuvent avoir
var selectionMode = 0 ;
var selectionMode = 0 ;
var selectionDiemension = 0 ;
var selectionDiemension = 0 ;
var allModeFrench = [ "Match à Point" , "Mode Timer" , "Infini" , "Bac" ] ; // Défini tout les modes de Jeu en français
var allModeEngl = [ "Point Match" , "Timer mode" , "Infini" , "Bac" ] ; // Défini tout les modes de Jeu en Anglais
var allDimension = [ "4 * 3" , "3 * 3" , "3 * 2" , "2 * 2" ] ; // Défini toutes les dimensions que les cartes peuvent avoir
var selectionMode = 0 ;
var selectionDiemension = 0 ;
var modelangue = false ;
var lesPoints = 0 ; //Points du Joueur1
var lesPoints = 0 ; //Points du Joueur1
@ -42,6 +50,53 @@ function modeSuiv() {
document . getElementById ( "textmode" ) . textContent = "" + allMode [ selectionMode ]
document . getElementById ( "textmode" ) . textContent = "" + allMode [ selectionMode ]
}
}
function dimensionPrec ( ) {
if ( selectionDiemension == 0 ) {
selectionDiemension = allDimension . length - 1 ;
} else {
selectionDiemension -= 1 ;
}
document . getElementById ( "textdimension" ) . textContent = "" + allDimension [ selectionDiemension ]
if ( ! modelangue ) {
if ( selectionMode == 0 ) {
selectionMode = allModeFrench . length - 1 ;
} else {
selectionMode -= 1 ;
}
document . getElementById ( "textmode" ) . textContent = "" + allModeFrench [ selectionMode ]
}
else {
if ( selectionMode == 0 ) {
selectionMode = allModeEngl . length - 1 ;
} else {
selectionMode -= 1 ;
}
document . getElementById ( "textmode" ) . textContent = "" + allModeEngl [ selectionMode ]
}
}
function modeSuiv ( ) {
if ( ! modelangue ) {
if ( selectionMode == allModeFrench . length - 1 ) {
selectionMode = 0 ;
} else {
selectionMode += 1 ;
}
document . getElementById ( "textmode" ) . textContent = "" + allModeFrench [ selectionMode ]
}
else {
if ( selectionMode == allModeEngl . length - 1 ) {
selectionMode = 0 ;
} else {
selectionMode += 1 ;
}
document . getElementById ( "textmode" ) . textContent = "" + allModeEngl [ selectionMode ]
}
}
function dimensionPrec ( ) {
function dimensionPrec ( ) {
if ( selectionDiemension == 0 ) {
if ( selectionDiemension == 0 ) {
selectionDiemension = allDimension . length - 1 ;
selectionDiemension = allDimension . length - 1 ;
@ -51,6 +106,7 @@ function dimensionPrec() {
document . getElementById ( "textdimension" ) . textContent = "" + allDimension [ selectionDiemension ]
document . getElementById ( "textdimension" ) . textContent = "" + allDimension [ selectionDiemension ]
}
}
function dimensionSuiv ( ) {
function dimensionSuiv ( ) {
if ( selectionDiemension == allDimension . length - 1 ) {
if ( selectionDiemension == allDimension . length - 1 ) {
selectionDiemension = 0 ;
selectionDiemension = 0 ;
@ -430,7 +486,17 @@ function lancerpartie() {
creePartieClassique3 _2 ( ) ;
creePartieClassique3 _2 ( ) ;
majSizeCard ( 2 ) ;
majSizeCard ( 2 ) ;
} else if ( selectionDiemension == 3 ) {
} else if ( selectionDiemension == 3 ) {
window . alert ( "Oups, il semblerait que ce mode ne soit pas encore disponible..." ) ;
window . alert ( "Oups, il semblerait que ce mode ne soit pas encore disponible..." ) ;
if ( ! modelangue ) {
window . alert ( "Oups, il semblerait que ce mode ne soit pas encore disponible..." ) ;
}
else {
window . alert ( "Oops, it seems that this mode is not yet available..." ) ;
}
ready = false ;
ready = false ;
}
}
@ -1238,7 +1304,13 @@ function chercherCombinaison() {
for ( var h = 0 ; h < DeckTeste . length ; h ++ ) {
for ( var h = 0 ; h < DeckTeste . length ; h ++ ) {
recup . push ( deckPartie . indexOf ( DeckTeste [ h ] ) + 1 ) ;
recup . push ( deckPartie . indexOf ( DeckTeste [ h ] ) + 1 ) ;
}
}
window . alert ( "Combinaison a " + ( N + 2 ) + " cartes trouvée : " + recup ) ;
if ( ! modelangue ) {
window . alert ( "Combinaison a " + ( N + 2 ) + " cartes trouvée : " + recup ) ;
}
else {
window . alert ( "Combination with " + ( N + 2 ) + " cards found : " + recup ) ;
}
}
}
}
}
}
}
@ -1281,7 +1353,17 @@ function printCombinations(array, p) {
}
}
}
}
run ( 0 , 0 ) ;
run ( 0 , 0 ) ;
window . alert ( "fin test " + k + " cartes" )
window . alert ( "fin test " + k + " cartes" )
if ( ! modelangue ) {
window . alert ( "fin test " + k + " cartes" )
}
else {
window . alert ( "end test " + k + " cards" )
}
}
}
window . alert ( "nb combi :" + Cptsolution ) ;
window . alert ( "nb combi :" + Cptsolution ) ;
}
}
@ -1307,7 +1389,13 @@ function testCombinaison(DeckTeste, combi, Cptsolution) {
//Reagarde si il y a une solution
//Reagarde si il y a une solution
if ( ! solution ) {
if ( ! solution ) {
Cptsolution ++ ;
Cptsolution ++ ;
window . alert ( "Combinaison à " + ( DeckTeste . length ) + " cartes trouvée : " + combi ) ;
if ( ! modelangue ) {
window . alert ( "Combinaison à " + ( DeckTeste . length ) + " cartes trouvée : " + combi ) ;
}
else {
window . alert ( "Combination with " + ( DeckTeste . length ) + " cards found : " + combi ) ;
}
}
}
return Cptsolution ;
return Cptsolution ;
}
}
@ -1352,11 +1440,23 @@ function chercheCombi2() {
}
}
if ( ! solution ) {
if ( ! solution ) {
Cptsolution ++ ;
Cptsolution ++ ;
window . alert ( "Combinaison a 2 trouve: " + ( i + 1 ) + " " + ( i + j + 2 ) ) ;
if ( ! modelangue ) {
window . alert ( "Combinaison a 2 trouve: " + ( i + 1 ) + " " + ( i + j + 2 ) ) ;
}
else {
window . alert ( "Combination with 2 found: " + ( i + 1 ) + " " + ( i + j + 2 ) ) ;
}
}
}
}
}
}
}
window . alert ( "Nombre de solution a 2 cartes : " + Cptsolution ) ;
if ( ! modelangue ) {
window . alert ( "Nombre de solution a 2 cartes : " + Cptsolution ) ;
}
else {
window . alert ( "Number of solutions with 2 cards : " + Cptsolution ) ;
}
}
}
//=================================================================================
//=================================================================================
@ -1440,15 +1540,33 @@ function chercheCombi3() {
}
}
if ( ! solution ) {
if ( ! solution ) {
Cptsolution ++ ;
Cptsolution ++ ;
window . alert ( "Combinaison a 3 trouve: " + ( i + 1 ) + " " + ( i + j + 2 ) + " " + ( k + j + i + 3 ) ) ;
if ( ! modelangue ) {
window . alert ( "Combinaison a 3 trouve: " + ( i + 1 ) + " " + ( i + j + 2 ) + " " + ( k + j + i + 3 ) ) ;
}
else {
window . alert ( "Combination with 3 found: " + ( i + 1 ) + " " + ( i + j + 2 ) + " " + ( k + j + i + 3 ) ) ;
}
}
}
}
}
}
}
}
}
if ( Cptsolution == 0 ) {
if ( Cptsolution == 0 ) {
window . alert ( "Pas de solution" ) ;
if ( ! modelangue ) {
window . alert ( "Pas de solution" ) ;
}
else {
window . alert ( "No solution" ) ;
}
}
if ( ! modelangue ) {
window . alert ( "Nombre de solution a 3 cartes : " + Cptsolution ) ;
}
}
window . alert ( "Nombre de solution a 3 cartes : " + Cptsolution ) ;
else {
window . alert ( "Number of solutions with 3 cards : " + Cptsolution ) ;
}
}
}
@ -1476,7 +1594,13 @@ function decompte() {
}
}
if ( cpt == 0 ) {
if ( cpt == 0 ) {
window . alert ( "fin du jeu" ) ;
if ( ! modelangue ) {
window . alert ( "fin du jeu" ) ;
}
else {
window . alert ( "Game Over" ) ;
}
retour ( ) ;
retour ( ) ;
window . location . reload ( ) ;
window . location . reload ( ) ;
clearInterval ( itv ) ;
clearInterval ( itv ) ;
@ -1507,10 +1631,22 @@ function testerLesCartes() {
function testPourJeuInfini ( ) {
function testPourJeuInfini ( ) {
try {
try {
if ( carteselect . length == 0 ) {
if ( carteselect . length == 0 ) {
window . alert ( "Selection Vide" ) ;
if ( ! modelangue ) {
window . alert ( "Selection Vide" ) ;
}
else {
window . alert ( "Empty selection" ) ;
}
return ;
return ;
} else if ( carteselect . length < 2 ) {
} else if ( carteselect . length < 2 ) {
window . alert ( "Selection Trop Petite" ) ;
if ( ! modelangue ) {
window . alert ( "Selection Trop Petite" ) ;
}
else {
window . alert ( "Selection Too Small" ) ;
}
return ;
return ;
} else {
} else {
var copie = [ ] ;
var copie = [ ] ;
@ -1539,10 +1675,28 @@ function testPourJeuInfini() {
}
}
}
}
if ( solution ) {
if ( solution ) {
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
}
}
if ( ! solution ) {
if ( ! solution ) {
document . getElementById ( "affSolution" ) . textContent = 'Assemblage de ' + copie . length + ' cartes trouvé !' ;
document . getElementById ( "affSolution" ) . textContent = 'Assemblage de ' + copie . length + ' cartes trouvé !' ;
if ( ! modelangue ) {
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
}
else {
document . getElementById ( "affSolution" ) . textContent = 'No solutions found...' ;
}
}
if ( ! solution ) {
if ( ! modelangue ) {
document . getElementById ( "affSolution" ) . textContent = 'Assemblage de ' + copie . length + ' cartes trouvé !' ;
}
else {
document . getElementById ( "affSolution" ) . textContent = 'Assembly of ' + copie . length + ' cards found !' ;
}
}
}
}
}
} catch ( e ) {
} catch ( e ) {
@ -1555,10 +1709,22 @@ function testPourJeuInfini() {
function testPourJeuClassique ( ) {
function testPourJeuClassique ( ) {
//try {
//try {
if ( carteselect . length == 0 ) {
if ( carteselect . length == 0 ) {
window . alert ( "Selection Vide test pour jeu classique" ) ;
if ( ! modelangue ) {
window . alert ( "Selection Vide test pour jeu classique" ) ;
}
else {
window . alert ( "Selection Empty test for classic game" ) ;
}
return ;
return ;
} else if ( carteselect . length < 2 ) {
} else if ( carteselect . length < 2 ) {
window . alert ( "Selection Trop Petite" ) ;
if ( ! modelangue ) {
window . alert ( "Selection Trop Petite" ) ;
}
else {
window . alert ( "Selection Too Small" ) ;
}
return ;
return ;
} else {
} else {
var copie = [ ] ;
var copie = [ ] ;
@ -1582,10 +1748,24 @@ function testPourJeuClassique() {
}
}
}
}
if ( solution ) {
if ( solution ) {
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
if ( ! modelangue ) {
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
}
else {
document . getElementById ( "affSolution" ) . textContent = 'No solutions found...' ;
}
}
}
if ( ! solution ) {
if ( ! solution ) {
document . getElementById ( "affSolution" ) . textContent = 'Assemblage de ' + copie . length + ' cartes trouvé ! Il reste encore ' + TasDuJEU . length + ' cartes !' ;
if ( ! modelangue ) {
document . getElementById ( "affSolution" ) . textContent = 'Assemblage de ' + copie . length + ' cartes trouvé ! Il reste encore ' + TasDuJEU . length + ' cartes !' ;
}
else {
document . getElementById ( "affSolution" ) . textContent = 'Assembly of ' + copie . length + ' cards found ! There are still ' + TasDuJEU . length + ' cards !' ;
}
}
}
}
}
/ * } c a t c h ( e ) {
/ * } c a t c h ( e ) {
@ -1627,11 +1807,23 @@ function copieLiseDeFigure(Liste) {
}
}
function copieFigure ( uneFigure ) {
function copieFigure ( uneFigure ) {
window . alert ( "Avant copiage " + uneFigure . CodeHTML )
if ( ! modelangue ) {
window . alert ( "Avant copiage " + uneFigure . CodeHTML )
}
else {
window . alert ( "Before copying " + uneFigure . CodeHTML )
}
if ( uneFigure == null ) {
if ( uneFigure == null ) {
return null ;
return null ;
}
}
window . alert ( "je fais la copie" )
if ( ! modelangue ) {
window . alert ( "je fais la copie" ) ;
}
else {
window . alert ( "I make the copy" ) ;
}
var copie = new Figure ( uneFigure . type , uneFigure . forme , uneFigure . X , uneFigure . Y ) ;
var copie = new Figure ( uneFigure . type , uneFigure . forme , uneFigure . X , uneFigure . Y ) ;
return copie ;
return copie ;
}
}
@ -1823,16 +2015,56 @@ function bacASable() {
afficherCartes ( lesCartes ) ;
afficherCartes ( lesCartes ) ;
}
}
function functionLange ( ) {
function functionLange ( ) {
if ( lange % 2 == 0 )
//window.alert(modelangue);
{
document . getElementById ( "flag_top" ) . classList . add ( "transparent" ) ;
if ( modelangue ) {
} else {
modelangue = false ;
document . getElementById ( "flag_top" ) . classList . remove ( "transparent" ) ;
//MODE FRANCAIS =======
document . getElementById ( 'flag_top' ) . src = "imgs/flags/flag-france.png" ;
document . getElementById ( 'textjouerr' ) . innerHTML = 'JOUER' ;
//Traduction classement
document . getElementById ( 'classementtxt' ) . textContent = 'Classement - solo' ;
document . getElementById ( 'premier' ) . textContent = '1er' ;
document . getElementById ( 'deuxieme' ) . textContent = '2e' ;
document . getElementById ( 'troisieme' ) . textContent = '3e' ;
//Traduction paramètres
document . getElementById ( 'SettingName' ) . textContent = 'Paramètres' ;
//Tradcution des règles
document . getElementById ( 'lesRegles' ) . textContent = 'Les Règles' ;
document . getElementById ( 'textRules' ) . textContent = 'Swish : Jeu de 60 cartes composé chacun de billes et de cerceaux, de 4 couleurs différentes possibles. 16 cartes sont posés sur une table et le joueur doit faire superposer des cartes de manière que chaque bille soit dans le cerceau de même couleur d’ une autre carte.' ;
}
else {
modelangue = true ;
//MODE ANGLAIS ========
document . getElementById ( 'flag_top' ) . src = "imgs/flags/flag-uk.png" ;
document . getElementById ( 'textjouerr' ) . innerHTML = 'PLAY' ;
//Traduction classement
document . getElementById ( 'classementtxt' ) . textContent = 'Ranking - solo' ;
document . getElementById ( 'premier' ) . textContent = '1st' ;
document . getElementById ( 'deuxieme' ) . textContent = '2nd' ;
document . getElementById ( 'troisieme' ) . textContent = '3rd' ;
//Traduction paramètres
document . getElementById ( 'SettingName' ) . textContent = 'Settings' ;
//Traduction des règles
document . getElementById ( 'lesRegles' ) . textContent = 'The Rules' ;
document . getElementById ( 'textRules' ) . textContent = 'Swish : Set of 60 cards each composed of balls and hoops, 4 different colors possible. 16 cards are placed on a table and the player has to lay cards on top of each other in such a way that each ball is in the same color hoop as another card.'
}
}
lange = lange + 1 ;
}
}