/* 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 mistakes ! Bravo !", "Good work !", "Great ! 0 mistakes !", "0 mistakes ! Excellent !", "No mistake ! ", "Super ! Not a mistake !");
// 1 faute
comment("One mistake : not bad !", "Just one mistake !", "Well done ! : only one mistake", "Well done !", "Good ! Only one mistake : nearly perfect !", "One small mistake : Bravo !");
// 2 fautes
comment("Not too bad (2 mistakes)", "2 mistakes, sufficiently good", "only 2 mistakes", "Just 2 mistakes. Cheer up !", "2 errors, you've done well", "2 small errors, nothing's the matter !"); 
// 3 fautes
comment("3 errors !", "3 errors, not too bad.", "3 mistakes : on the way to success.", "3 errors : you can do better !", "Not bad : 3 errors", "3 mistakes : not bad, anyway !");
// 4 fautes
comment("4 errors; you have to do it better", "Attention, 2 more errors and you're dead !", "4 mistakes : difficult ?", "4 errors : it isn't easy, is it ?", "4 errors !");
// 5 fautes
comment("5 errors. Oops, that was close !", "5 mistakes : the rope was near !", "5 errors : The rope has touched your neck...", "You nearly met Mrs Death : 5 errors", "It was close, one more mistake and you're dead !", "Just as well ! you've saved your head from the rope !");
// 6 fautes
comment("You are dead !", "You lose !", "A pity, you've lost...", "Lost ! Try again !", "Lost and hanged !", "You've lost your chance !");   
