Ejemplo n.º 1
0
  /**
   * Dependiendo del array introducido creara un tipo de juego u otro
   *
   * @param frase array de string con el posible juego a cambiar (y dimensiones si procede)
   */
  public void opcCambiarJuego(String[] frase) {
    boolean error = true;
    if (frase.length == 3 || frase.length == 5) {
      if (frase[1].equalsIgnoreCase("c4")) {
        jugarC4(Integer.parseInt(frase[2]));
        error = false;
      } else if (frase[1].equalsIgnoreCase("co")) {
        jugarCo(Integer.parseInt(frase[2]));
        error = false;
      } else if (frase[1].equalsIgnoreCase("rv")) {
        jugarRv(Integer.parseInt(frase[2]));
        error = false;
      } else if (frase.length == 5 && frase[1].equalsIgnoreCase("gr")) {
        jugarGravity(frase);
        error = false;
      } else if (frase.length == 5 && frase[1].equalsIgnoreCase("tr")) {
        jugarTresRaya(frase);
        error = false;
      }
    }

    if (error) {
      System.err.println("No te entiendo.");
      partida.refrescar();
    } else {
      reiniciarPartida();
    }
  }
Ejemplo n.º 2
0
 /**
  * Se encarga de controlar la parte de ejecución de un movimiento(cuando el usuario introduce
  * poner)
  */
 public void opcPoner() {
   try {
     if (this.partida.getTurno() == Ficha.NEGRA) {
       this.jugturno = jugnegras;
     } else {
       this.jugturno = jugblancas;
     }
     this.partida.poner(this.jugturno);
   } catch (MovimientoInvalido e) {
     System.err.println(e.getMessage());
   } catch (InputMismatchException e) {
     System.err.println("Columna incorrecta.");
     this.in.nextLine();
     partida.refrescar();
   }
   ;
 }
Ejemplo n.º 3
0
 public void opcPasarTurno() {
   this.partida.pasaTurno();
   partida.refrescar();
 }