Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package puzzle8;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- /**
- *
- * @author Kelvin
- */
- public class Puzzle8 {
- public static void main(String[] args) {
- boolean result = true;
- List<Tabuleiro> abertos = new ArrayList<Tabuleiro>();
- List<Tabuleiro> fechados = new ArrayList<Tabuleiro>();
- List<Tabuleiro> aux = new ArrayList<Tabuleiro>();
- Tabuleiro tab = new Tabuleiro();
- tab.tabInicial();
- tab.imprimiTab(tab.posicoes);
- if (tab.igual(tab.posicoes) == false) {
- aux = tab.geraFilhos();
- for (int k = 0; k < aux.size(); k++) {
- if (tab.igual(aux.get(k).posicoes) == false) {
- fechados.add(aux.get(k));
- Collections.sort(fechados);
- }
- }
- }
- while (tab.igual(fechados.get(0).posicoes) == false) {
- abertos.add(fechados.get(0));
- tab.imprimiTab(aux.get(0).posicoes);
- fechados.remove(fechados.get(0));
- Collections.sort(fechados);
- if (result == true) {
- System.out.println("achou a resolucao");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment