Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. private Chemin cheminJoyau2(Plateau plateau2, int currentX, int currentY, Orientations currentOrien) {
  2. ArrayList<ArrayList<Carte>> listeC = new ArrayList<ArrayList<Carte>>();
  3. boolean accessJoyau = false;
  4.  
  5. while (accessJoyau) {
  6. int x = currentX;
  7. int y = currentY;
  8. Orientations orientation = currentOrien;
  9. int taille = listeC.size();
  10. for(int i=0;i<taille+1;i++) {
  11. ArrayList copy = new ArrayList(listeC.get(i));
  12. listeC.add(copy);
  13. listeC.add(copy);
  14. listeC.add(copy);
  15. listeC.get(i).add(new Carte(TypeCarte.CARTE_BLEUE));
  16. listeC.get(taille+i*3).add(new Carte (TypeCarte.CARTE_VIOLETTE));
  17. listeC.get(taille+i*3+1).add(new Carte (TypeCarte.CARTE_JAUNE));
  18. listeC.get(taille+i*3+2).add(new Carte (TypeCarte.LASER));
  19. }
  20. for (int i=0;i<listeC.size();i++) {
  21. Programme programmeTest = new Programme();
  22. for (int j=0; j<listeC.get(i).size();j++) {
  23. programmeTest.enfilerCarte(listeC.get(i).get(j));
  24. }
  25. Joueur test = new Joueur(this);
  26. test.getTortue().setPosition(x, y, orientation);
  27. test.setProgramme(programmeTest);
  28. test.executerPrgm(this);
  29. if (test.getTortue().getPosition().getX() == 7 && test.getTortue().getPosition().getY() == 3) {
  30. return new Chemin(listeC.get(i).size(),listeC.get(i));
  31. }
  32. }
  33.  
  34. }
  35. return null;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement