Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. package AStar;
  2. import java.util.*;
  3. public class Main
  4. {
  5. public static void main(String[] args)
  6. {
  7. int userInput = 0;
  8. //Scanner kb = new Scanner(System.in);
  9. //3,1,2,6,4,5,0,7,8 312405678 625714083 250314687 235104678 d4 1,4,2,3,5,8,6,7,0 d6 1,4,2,3,0,7,6,8,5
  10. //D10 4,2,5,1,3,8,0,6,7 D12 1,4,2,6,7,5,8,3,0 D20 0,5,7,2,8,4,1,3,6 D 10 0,4,1,3,6,2,7,8,5 1,2,5,3,7,8,4,6,0
  11. //18,4,3,0,2,6,5,7 D20 0,8,5,2,3,7,1,4,6
  12. int[] test = {0,8,5,2,3,7,1,4,6}; //hi
  13. EightBoard board = new EightBoard(test, 1); //the entered heuristic will be overrided
  14.  
  15. AStarAlg unfinished = new AStarAlg(board.getboardState());
  16. printResult(unfinished, board);
  17. //manhattans off and hashsets not working
  18. /*
  19. System.out.println("Iteration two");
  20. EightBoard board2 = new EightBoard(test, 2);
  21. AStarAlg unfinished2 = new AStarAlg(board2.getboardState());
  22. printResult(unfinished2, board2);
  23. */
  24.  
  25. }
  26. public static void printResult(AStarAlg unfinished, EightBoard board)
  27. {
  28. boolean exploredSet = false;
  29. System.out.println("Manhattan nodes: " + unfinished.manhattan(exploredSet));
  30. System.out.println("Manhattan total steps: " + unfinished.getTotalSteps());
  31.  
  32. System.out.println("Hamming nodes: " + unfinished.hamming(exploredSet));
  33. System.out.println("Hamming total steps: " + unfinished.getTotalSteps());
  34.  
  35. System.out.println("\n\nExploredSet on Now");
  36. exploredSet = true;
  37.  
  38. System.out.println("Manhattan Nodes: " + unfinished.manhattan(exploredSet));
  39. System.out.println("Manhattan total steps: " + unfinished.getTotalSteps());
  40.  
  41. System.out.println("Hamming nodes: " + unfinished.hamming(exploredSet));
  42. System.out.println("Hamming total steps: " + unfinished.getTotalSteps());
  43.  
  44.  
  45. }
  46. public void menu()
  47. {
  48. Scanner kb = new Scanner(System.in);
  49. int userInput = 0;
  50. while(userInput != 1 && userInput != 2 && userInput != 3)
  51. {
  52. System.out.println("Welcome to my program.");
  53. System.out.println("Enter 1 to create your own puzzle.");
  54. System.out.println("Enter 2 to generate a random puzzle.");
  55. System.out.println("Enter 3 to exit.");
  56. System.out.print("Enter your choice here: ");
  57. userInput = kb.nextInt();
  58. }
  59. switch(userInput)
  60. {
  61. case 1:
  62.  
  63. }
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement