Package be.steformations.pendu.av.oldschool

Examples of be.steformations.pendu.av.oldschool.Pendu


    PrintWriter out = res.getWriter();
    out.println("<html><head><title>Le jeu du Pendu</title></head>");
    out.println("<body><h1>Le jeu du Pendu</h1>");

    HttpSession session = req.getSession(true);
    Pendu pendu = (Pendu) session.getAttribute("pendu");

    String[] recommencer = req.getParameterValues("recommencer");
    String[] lettres = req.getParameterValues("lettre");
    char lettre = 0;
    if (lettres != null && lettres.length > 0) {
      String l = lettres[0];
      char[] le = l.toCharArray();
      lettre = le[0];
    }

    if (recommencer != null && recommencer.length > 0
        && "true".equals((recommencer)[0])) {
      pendu = null;
    }

    if (pendu == null) {
      // try {
      // pendu = new ste.pendu.Pendu( this.loadList( uri ) );
      pendu = new Pendu(Main1.LISTEPENDU);
      pendu.joue();
      session.setAttribute("pendu", pendu);
      this.affiche(out, pendu);
      this.afficheLettres(out);
      /*
       * } catch( IOException iox ) { this.context.log( "Fichier: " + uri
       * + " non trouv�" + iox.getMessage(), iox ); out.println(
       * "Fichier: " + uri + " non trouv�<br>" + iox.getMessage() + "<br>"
       * ); }
       */
    } else {
      this.affiche(out, pendu);
      if (!pendu.gagne() && !pendu.perdu()) {
        pendu.ajoute(lettre);
        out.println("Il vous reste " + (7 - pendu.getErreurs())
            + " possibilit�(s) de vous tromper<br>");
        this.afficheLettres(out);
      } else if (pendu.gagne()) {
        out.println("Vous avez gagn�!<br>");
      } else {
        out.println("Vous avez perdu! <br>");
      }
    }
View Full Code Here

TOP

Related Classes of be.steformations.pendu.av.oldschool.Pendu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.