private void buscarSolucion(Tablero tablero, ArrayList<Movimiento> solucion, Booleano exito) {
if(tablero.esSolucion())
exito.setValor(true);
ArrayList<Movimiento> movs = tablero.obtenerMovimientos();
for (Movimiento mov : movs) {
if (tablero.esMovimientoValido(mov)) {
tablero.anotarMovimiento(mov);
solucion.add(mov);
if(tablero.esSolucion()) {
exito.setValor(true);
return;
} else
buscarSolucion(tablero, solucion, exito);
if(!exito.getValor()) {
tablero.desanotarMovimiento(mov);
solucion.remove(mov);
}
}
}
exito.setValor(false);
}
Thanks.

New Topic/Question
Reply


MultiQuote





|