Exemple #1
0
 /**
  * Metodo auxiliar para pasar una string (eg K4s o Kh5h) a coordenadas
  *
  * @param mano
  * @return
  */
 private int[] parseManoACoordenadas(String mano) {
   int x = 0, y = 0, iz, dr;
   if (mano.length() == 2) { // pareja
     x = Utilidades.char2int(mano.charAt(0));
     y = Utilidades.char2int(mano.charAt(1));
   } else if (mano.length() == 3) {
     if (mano.charAt(2) == 's') { // suited
       iz = Utilidades.char2int(mano.charAt(0));
       dr = Utilidades.char2int(mano.charAt(1));
       if (iz >= dr) {
         x = iz;
         y = dr;
       } else {
         x = dr;
         y = iz;
       }
     } else { // offsuited
       iz = Utilidades.char2int(mano.charAt(0));
       dr = Utilidades.char2int(mano.charAt(1));
       if (iz >= dr) {
         y = iz;
         x = dr;
       } else {
         y = dr;
         x = iz;
       }
     }
   } else if (mano.length() == 4) {
     if (mano.charAt(1) == mano.charAt(3)) { // suited
       iz = Utilidades.char2int(mano.charAt(0));
       dr = Utilidades.char2int(mano.charAt(2));
       if (iz >= dr) {
         x = iz;
         y = dr;
       } else {
         x = dr;
         y = iz;
       }
     } else { // offsuited
       iz = Utilidades.char2int(mano.charAt(0));
       dr = Utilidades.char2int(mano.charAt(2));
       if (iz >= dr) {
         y = iz;
         x = dr;
       } else {
         y = dr;
         x = iz;
       }
     }
   } else {
     // excepcion
   }
   return new int[] {x, y};
 }
Exemple #2
0
  public void marcarPolarizado(int w, int x, int y, int z, Ranking ranking) {

    // Poner todos a false
    for (int i = 0; i < Constantes.TABLA_RANGOS_X; i++)
      for (int j = 0; j < Constantes.TABLA_RANGOS_X; j++) this.rango[i][j] = false;

    float numManos = 0;
    float numManosW = (w * 1326) / 100;
    float numManosX = (x * 1326) / 100;
    float numManosY = (y * 1326) / 100;
    float numManosZ = (z * 1326) / 100;

    String mano;
    int fil, col;

    for (int cont = 0; cont < Constantes.TABLA_RANGOS_X * Constantes.TABLA_RANGOS_X; cont++) {
      mano = ranking.at(cont);

      if (mano.length() == 2) { // pareja
        numManos += 6;
        fil = Utilidades.char2int(mano.charAt(0));
        col = fil;
      } else { // length == 3
        if (mano.charAt(mano.length() - 1) == 's') { // suited
          numManos += 4;
          fil = Utilidades.char2int(mano.charAt(0));
          col = Utilidades.char2int(mano.charAt(1));
        } else { // offsuited
          numManos += 12;
          col = Utilidades.char2int(mano.charAt(0));
          fil = Utilidades.char2int(mano.charAt(1));
        }
      }

      if ((numManos > numManosW && numManos < numManosX)
          || (numManos > numManosY && numManos <= numManosZ)) { // entra dentro del rango
        this.rango[fil][col] = true;
      }
    }
  }
Exemple #3
0
  /**
   * Marca el rango segun un porcentaje determinado por E_Rankings
   *
   * @param porcentaje el porcentaje de manos que se quieren marcar
   * @param ranking el ranking a usar
   */
  public void marcarPorcentaje(float porcentaje, Ranking ranking) {

    // Poner todos a false
    for (int i = 0; i < Constantes.TABLA_RANGOS_X; i++)
      for (int j = 0; j < Constantes.TABLA_RANGOS_X; j++) this.rango[i][j] = false;
    // Por la forma en la que funcionan los float, no pilla bien el 100%
    if (porcentaje >= 100.0) {
      porcentaje = 101;
    }
    float numManosPorMarcar = (porcentaje * 1326) / 100; // manos preflop que cubre el porcentaje

    String mano;
    int fil, col;

    for (int cont = 0;
        (cont < Constantes.TABLA_RANGOS_X * Constantes.TABLA_RANGOS_X) && numManosPorMarcar >= 0;
        cont++) {
      mano = ranking.at(cont);

      if (mano.length() == 2) { // pareja
        numManosPorMarcar -= 6;
        fil = Utilidades.char2int(mano.charAt(0));
        col = fil;
      } else { // length == 3
        if (mano.charAt(mano.length() - 1) == 's') { // suited
          numManosPorMarcar -= 4;
          fil = Utilidades.char2int(mano.charAt(0));
          col = Utilidades.char2int(mano.charAt(1));
        } else { // offsuited
          numManosPorMarcar -= 12;
          col = Utilidades.char2int(mano.charAt(0));
          fil = Utilidades.char2int(mano.charAt(1));
        }
      }

      if (numManosPorMarcar >= 0) // entra dentro del rango
      this.rango[fil][col] = true;
    }
  }