Examples of Tauler


Examples of prop.cluster.domini.models.Tauler

        -1,
        -1
    };
    int maxim_actual;
    int maxim = Integer.MIN_VALUE;
    Tauler tauler = partida.getTauler();
    int mida = tauler.getMida();
    int profunditat = 0;
    EstatCasella fitxa_jugador = EstatCasella.JUGADOR_B;
    if ( estat_casella == EstatCasella.JUGADOR_A )
    {
      fitxa_jugador = EstatCasella.JUGADOR_A;
    }

    for ( int fila = 0; fila < mida; ++fila )
    {
      for ( int columna = 0; columna < mida; ++columna )
      {
        try
        {
          tauler.mouFitxa( estat_casella, fila, columna );
        }
        catch ( IllegalArgumentException excepcio )
        {
          continue;
        }
        EstatPartida estat_partida = partida.comprovaEstatPartida( fila, columna );
        estat_casella = this.intercanviaEstatCasella( estat_casella );
        maxim_actual =
            this.valorMax( partida, estat_partida, Integer.MIN_VALUE, Integer.MAX_VALUE, estat_casella,
                profunditat + 1, profunditat_maxima, fitxa_jugador );
        if ( maxim_actual > maxim )
        {
          maxim = maxim_actual;
          millor_moviment[0] = fila;
          millor_moviment[1] = columna;
        }
        tauler.treuFitxa( fila, columna );
        estat_casella = intercanviaEstatCasella( estat_casella );
      }
    }
    return millor_moviment;
  }
View Full Code Here

Examples of prop.cluster.domini.models.Tauler

   *         <em>partida</em>.
   */
  private int valorMax( Partida partida, EstatPartida estat_partida, int alfa, int beta, EstatCasella estat_casella,
                        int profunditat, int profunditat_maxima, EstatCasella fitxa_jugador )
  {
    Tauler tauler = partida.getTauler();
    if ( profunditat == profunditat_maxima || estat_partida == EstatPartida.GUANYA_JUGADOR_A ||
         estat_partida == EstatPartida.GUANYA_JUGADOR_B || estat_partida == EstatPartida.EMPAT )
    {
      return funcioAvaluacio( tauler, estat_partida, profunditat, fitxa_jugador );
    }
    else
    {
      int mida = tauler.getMida();
      for ( int fila = 0; fila < mida; ++fila )
      {
        for ( int columna = 0; columna < mida; ++columna )
        {
          try
          {
            tauler.mouFitxa( estat_casella, fila, columna );
          }
          catch ( IllegalArgumentException excepcio )
          {
            continue;
          }
          EstatPartida estat_partida_aux = partida.comprovaEstatPartida( fila, columna );
          estat_casella = intercanviaEstatCasella( estat_casella );
          alfa = Math.max( alfa,
              this.valorMin( partida, estat_partida_aux, alfa, beta, estat_casella, ( profunditat + 1 ),
                  profunditat_maxima, fitxa_jugador ) );
          tauler.treuFitxa( fila, columna );
          if ( alfa >= beta )
          {
            return beta;
          }
          estat_casella = intercanviaEstatCasella( estat_casella );
View Full Code Here

Examples of prop.cluster.domini.models.Tauler

   *         <em>partida</em>.
   */
  private int valorMin( Partida partida, EstatPartida estat_partida, int alfa, int beta, EstatCasella estat_casella,
                        int profunditat, int profunditat_maxima, EstatCasella fitxa_jugador )
  {
    Tauler tauler = partida.getTauler();
    if ( profunditat == profunditat_maxima || estat_partida == EstatPartida.GUANYA_JUGADOR_A ||
         estat_partida == EstatPartida.GUANYA_JUGADOR_B || estat_partida == EstatPartida.EMPAT )
    {
      return funcioAvaluacio( tauler, estat_partida, profunditat, fitxa_jugador );
    }
    else
    {
      int mida = tauler.getMida();
      for ( int fila = 0; fila < mida; ++fila )
      {
        for ( int columna = 0; columna < mida; ++columna )
        {
          try
          {
            tauler.mouFitxa( estat_casella, fila, columna );
          }
          catch ( IllegalArgumentException excepcio )
          {
            continue;
          }
          EstatPartida estat_partida_aux = partida.comprovaEstatPartida( fila, columna );
          estat_casella = this.intercanviaEstatCasella( estat_casella );
          beta = Math.min( beta,
              this.valorMax( partida, estat_partida_aux, alfa, beta, estat_casella, ( profunditat + 1 ),
                  profunditat_maxima, fitxa_jugador ) );
          tauler.treuFitxa( fila, columna );
          if ( alfa >= beta )
          {
            return alfa;
          }
          estat_casella = this.intercanviaEstatCasella( estat_casella );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.