/* auteur: Bernard Martin-Rabaud */
/* date de creation: 16/02/01 */

// *****************************************************
// JEU DU PENDU : CLASSE DES COMMENTAIRES
// *****************************************************


// *****************************************************
// SOMMAIRE GENERAL
// - PARAMETRES (dans fichier pendu_param.js)
// - VARIABLES GLOBALES
// - CLASSE ET METHODES "ALPHABET" (pendu_alpha.js)
// - CLASSE ET METHODES "MOT" (pendu_mot.js)
// - CLASSE ET METHODES "LETTRE" (ce fichier)
// - CLASSE ET METHODES "IMAGE" (pendu_image.js)
// - CLASSE ET METHODES "SCORE" (pendu_score.js)
// - CLASSE ET METHODES "AIDE" (pendu_aide.js)
// - CLASSE ET METHODES "JEU" (pendu_jeu.js)
// *****************************************************

// *****************************************************
// VARIABLES GLOBALES
var LComments = new Array();
// *****************************************************


// *****************************************************
// CLASSE DES COMMENTAIRES EN FONCTION DU RESULTAT DU JEU

function CComment(args) {
   // liste des libellés corrsespondant au niveau d'erreur
   this.libs = new Array(args.length);
   for (var i=0;i<args.length;i++) this.libs[i] = args[i];
}

function CCm_choix_lib(erreur) {
   var n = Math.round(Math.random() * this.libs.length);
//   alert("erreurs = " + erreur + ", num commentaire = " + n + "\n" + this.libs[n]);
   alert(this.libs[n]);
}

CComment.prototype.choix_lib = CCm_choix_lib;

function comment() {
   LComments[LComments.length] = new CComment(arguments);
}

function commentaire(erreur) {
   LComments[erreur].choix_lib(erreur);
}

// 0 faute
comment("0 error ! Bravissimo !", "first move!", "Great ! 0 error !", "0 error ! Excellent !", "no error ! cool !", "Wow ! no mistake !");
// 1 faute
comment("1 error : not bad!", "Only 1 error !", "Very Good : 1 errort", "Excellent 1 error !", "Just 1 error : ,nearly perfect !", "a small error : Bravo !");
// 2 fautes
comment("Not too bad (2 errors)", "2 errors, good", "Only 2 errors", "Just 2 errors. Cheers !", "2 errors, that's good", "2 small errors!"); 
// 3 fautes
comment("3 errors !", "3 errors, it is not too bad.", "3 errors : good!", "3 errors : can do better !", "Not bad : 3 errors", "3 errors : ok !");
// 4 fautes
comment("4 errors; hum hum!", "becarefull, 2 errors more and you are dead !", "4 errors : difficult ?", "4 errors : not easy!", "4 errors !");
// 5 fautes
comment("5 errors. Ups, very near !", "5 errors : not far from the rope !", "5 errors : oh oh...", "lucky : 5 errors", "one more error and the rope was for you!", "lucky strike ! you are safe !");
// 6 fautes
comment("You are hanged !", "Game over !", "How bad!", "You lost ! you were a good friend !", "Lost and Hanged !", "How bad ! Game Over !");   
