コード例 #1
0
  public static void mostrarTablero(Tablero tablero) {
    Pieza[][] tab = tablero.getTablero();

    clearConsole();

    System.out.println();
    System.out.println("   1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ");

    for (int f = 0; f < tablero.getFilas(); f++) {
      System.out.print(f + 1);

      for (int c = 0; c < tablero.getColumnas(); c++) {
        if (tab[f][c] == null) {
          System.out.print("  - ");
        } else {
          System.out.print("  " + tab[f][c].getRepresentacion() + " ");
        }
      }

      System.out.println();
    }

    System.out.println();
  }