Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with loop in java

 
carlos novoa
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good evening dear forum colleagues,
I have a problem with a loop. I am programming the movements of the horse in a loop in java.
I use the backtracking algorithm and the program works well and prints the whole board with all the movements.
I want to print the movement of the horse every time on the board with a new board each time but I dont know how to do it.
The array I use is tabla, this array comes from the method with the backtracking algorithm.

Any help will be appreciated.

The code I use is this:

public void escribirTablerofinal () {
int i = 0;
int j = 0;
for (i = 0; i < FILAS; i++) {
System.out.println(" -----------------------------------------");
for (j = 0; j < COLUMNAS; j++) {
if (tabla[i][j] > 9) {
System.out.print(" | " + tabla[i][j]);
}
else {
System.out.print(" | " + tabla[i][j] + " ");
}
}
System.out.println(" |");
}
System.out.println(" -----------------------------------------");
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic