Logger.java 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package pathgame.logging;
  2. import pathgame.algorithm.SaleRoute;
  3. import pathgame.gameplay.Player;
  4. import pathgame.tilemap.TileMap;
  5. import java.util.ArrayList;
  6. public class Logger
  7. {
  8. public static void onLevelReset(int level, Player p, TileMap map)
  9. {
  10. System.out.println("Level Reset " + level);
  11. }
  12. public static void onTileEnter(Player p, TileMap map, int x, int y)
  13. {
  14. System.out.println("Tile Enter " + x + " " + y);
  15. }
  16. public static void onTileLeave(Player p, TileMap map, int x, int y)
  17. {
  18. System.out.println("Tile Leave " + x + " " + y);
  19. }
  20. public static void onWin(Player p, TileMap map)
  21. {
  22. System.out.println("Win");
  23. }
  24. public static void onAlgoDone(ArrayList<ArrayList<SaleRoute>> salesPitch, ArrayList<Integer> eulerTour) {
  25. System.out.println("algorithm done");
  26. /*TODO: follow the eulerTour, getting salesPitch.get(x).get(y).get(path)
  27. TODO: and getting the x and y value of each coord in that list and logging them*/
  28. /*x and y correspond indirectly to values of the eulerTour
  29. * salesPitch is structured like so:
  30. * [town0] [town1] [town2] [town3] ...
  31. * [town0] - x:0/y:0 x:0/y:1 x:0/y:2
  32. * [town1] - - x:1/y:0 x:1/y:1
  33. * [town2] - - - x:2/y:0
  34. * [town3] - - - -
  35. * ...*/
  36. /*so to get the path between node 0 and 1 use salesPitch.get(0).get(0).get(path);
  37. * (x is equal to [townRowIndex], y is equal to [townColIndex] - x - 1 (!!!))
  38. * note that paths between x and y are equal to paths between y and x, but only one can be found in salesPitch
  39. * so the path between 0 - 1 and 1 - 0 are the same, but only 0 - 1 can be accessed
  40. * make sure that x <= y to not go out of bounds*/
  41. /*Example eulerTour: 3, 0, 1, 2, 3
  42. * Therefore, the paths logged need to be:
  43. * salesPitch.get(0).get(2).get(path)
  44. * salesPitch.get(0).get(0).get(path)
  45. * salesPitch.get(1).get(0).get(path)
  46. * salesPitch.get(2).get(0).get(path)
  47. * */
  48. /*NOTE: for visual representation, algorithm coordinates don't have to be logged in order
  49. * for the final representation to be correct. If the end-output is a list of coordinates, though,
  50. * it may be necessary to order the coordinates to form a continuous path*/
  51. }
  52. }