Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 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
  11. int[] test = {4,2,5,1,3,8,0,6,7}; //hi
  12. EightBoard board = new EightBoard(test, 1); //this will get over written
  13. AStarAlg unfinished = new AStarAlg(board.getboardState());
  14. printResult(unfinished, board);
  15. //manhattans off and hashsets not working
  16. /*
  17. System.out.println("Iteration two");
  18. EightBoard board2 = new EightBoard(test, 2);
  19. AStarAlg unfinished2 = new AStarAlg(board2.getboardState());
  20. printResult(unfinished2, board2);
  21.  
  22. */
  23.  
  24. }
  25. public static void printResult(AStarAlg unfinished, EightBoard board)
  26. {
  27. boolean exploredSet = false;
  28. System.out.println("Manhattan nodes: " + unfinished.manhattan(exploredSet));
  29. System.out.println("Manhattan total steps: " + unfinished.getTotalSteps());
  30.  
  31. System.out.println("Hamming nodes: " + unfinished.hamming(exploredSet));
  32. System.out.println("Hamming total steps: " + unfinished.getTotalSteps());
  33.  
  34. System.out.println("ExploredSet on Now");
  35. exploredSet = true;
  36.  
  37. System.out.println("Manhattan Nodes: " + unfinished.manhattan(exploredSet));
  38. System.out.println("Manhattan total steps: " + unfinished.getTotalSteps());
  39.  
  40. System.out.println("Hamming nodes: " + unfinished.hamming(exploredSet));
  41. System.out.println("Hamming total steps: " + unfinished.getTotalSteps());
  42.  
  43. }
  44. public void menu()
  45. {
  46. Scanner kb = new Scanner(System.in);
  47. int userInput = 0;
  48. while(userInput != 1 && userInput != 2 && userInput != 3)
  49. {
  50. System.out.println("Welcome to my program.");
  51. System.out.println("Enter 1 to create your own puzzle.");
  52. System.out.println("Enter 2 to generate a random puzzle.");
  53. System.out.println("Enter 3 to exit.");
  54. System.out.print("Enter your choice here: ");
  55. userInput = kb.nextInt();
  56. }
  57. switch(userInput)
  58. {
  59. case 1:
  60.  
  61. }
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement