/* 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 faute ! Bravo !");
// 1 faute
comment("c'est bien");
// 2 fautes
comment("Ca va"); 
// 3 fautes
comment("c'est moyen !");
// 4 fautes
comment("attention; vous vous débrouillez assez bien");
// 5 fautes
comment("vous avez presque perdu !");
// 6 fautes
comment("Vous avez perdu !");   
