@ -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 selectionMode = 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
@ -49,8 +57,56 @@ function dimensionPrec() {
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 ( ) {
if ( selectionDiemension == 0 ) {
selectionDiemension = allDimension . length - 1 ;
} else {
selectionDiemension -= 1 ;
}
document . getElementById ( "textdimension" ) . textContent = "" + allDimension [ selectionDiemension ]
}
function dimensionSuiv ( ) {
if ( selectionDiemension == allDimension . length - 1 ) {
selectionDiemension = 0 ;
@ -430,7 +486,17 @@ function lancerpartie() {
creePartieClassique3 _2 ( ) ;
majSizeCard ( 2 ) ;
} else if ( selectionDiemension == 3 ) {
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 ;
}
@ -1238,8 +1304,14 @@ function chercherCombinaison() {
for ( var h = 0 ; h < DeckTeste . length ; h ++ ) {
recup . push ( deckPartie . indexOf ( DeckTeste [ h ] ) + 1 ) ;
}
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 ) ;
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 ) ;
}
@ -1307,8 +1389,14 @@ function testCombinaison(DeckTeste, combi, Cptsolution) {
//Reagarde si il y a une solution
if ( ! solution ) {
Cptsolution ++ ;
if ( ! modelangue ) {
window . alert ( "Combinaison à " + ( DeckTeste . length ) + " cartes trouvée : " + combi ) ;
}
else {
window . alert ( "Combination with " + ( DeckTeste . length ) + " cards found : " + combi ) ;
}
}
return Cptsolution ;
}
@ -1352,11 +1440,23 @@ function chercheCombi2() {
}
if ( ! solution ) {
Cptsolution ++ ;
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 ) ) ;
}
}
}
}
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 ) {
Cptsolution ++ ;
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 ( ! modelangue ) {
window . alert ( "Pas de solution" ) ;
}
else {
window . alert ( "No solution" ) ;
}
}
if ( ! modelangue ) {
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 ( ! modelangue ) {
window . alert ( "fin du jeu" ) ;
}
else {
window . alert ( "Game Over" ) ;
}
retour ( ) ;
window . location . reload ( ) ;
clearInterval ( itv ) ;
@ -1507,10 +1631,22 @@ function testerLesCartes() {
function testPourJeuInfini ( ) {
try {
if ( carteselect . length == 0 ) {
if ( ! modelangue ) {
window . alert ( "Selection Vide" ) ;
}
else {
window . alert ( "Empty selection" ) ;
}
return ;
} else if ( carteselect . length < 2 ) {
if ( ! modelangue ) {
window . alert ( "Selection Trop Petite" ) ;
}
else {
window . alert ( "Selection Too Small" ) ;
}
return ;
} else {
var copie = [ ] ;
@ -1539,10 +1675,28 @@ function testPourJeuInfini() {
}
}
if ( solution ) {
document . getElementById ( "affSolution" ) . textContent = 'Aucune solution trouvée...' ;
}
if ( ! solution ) {
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 ) {
@ -1555,10 +1709,22 @@ function testPourJeuInfini() {
function testPourJeuClassique ( ) {
//try {
if ( carteselect . length == 0 ) {
if ( ! modelangue ) {
window . alert ( "Selection Vide test pour jeu classique" ) ;
}
else {
window . alert ( "Selection Empty test for classic game" ) ;
}
return ;
} else if ( carteselect . length < 2 ) {
if ( ! modelangue ) {
window . alert ( "Selection Trop Petite" ) ;
}
else {
window . alert ( "Selection Too Small" ) ;
}
return ;
} else {
var copie = [ ] ;
@ -1582,11 +1748,25 @@ function testPourJeuClassique() {
}
}
if ( solution ) {
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 ( ! 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 ) {
window . alert ( e ) ;
@ -1627,11 +1807,23 @@ function copieLiseDeFigure(Liste) {
}
function copieFigure ( uneFigure ) {
if ( ! modelangue ) {
window . alert ( "Avant copiage " + uneFigure . CodeHTML )
}
else {
window . alert ( "Before copying " + uneFigure . CodeHTML )
}
if ( uneFigure == 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 ) ;
return copie ;
}
@ -1823,16 +2015,56 @@ function bacASable() {
afficherCartes ( lesCartes ) ;
}
function functionLange ( ) {
if ( lange % 2 == 0 )
{
document . getElementById ( "flag_top" ) . classList . add ( "transparent" ) ;
} else {
document . getElementById ( "flag_top" ) . classList . remove ( "transparent" ) ;
//window.alert(modelangue);
if ( modelangue ) {
modelangue = false ;
//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.' ;
}
lange = lange + 1 ;
}
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.'
}
}