A java PacMan game application for A.U.TH (data structures class)
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

116 行
3.5 KiB

  1. /**
  2. * @file Globals.java
  3. * @brief
  4. * File containing the Globals class, a helper class for the
  5. * vector based evaluation system
  6. *
  7. * @author Christos Choutouridis 8997 cchoutou@ece.auth.gr
  8. * @author Konstantina Tsechelidou 8445 konstsec@ece.auth.gr
  9. */
  10. package gr.auth.ee.dsproject.node;
  11. import gr.auth.ee.dsproject.pacman.PacmanUtilities;
  12. /**
  13. * @class Globals
  14. * @brief
  15. * Contains constants and factors to trick
  16. * the Node evaluation algorithm
  17. */
  18. public class Globals {
  19. /*
  20. * Evaluation settings
  21. */
  22. /**
  23. * Mixing factor for the minimum distance
  24. */
  25. // ghosts
  26. public static final double EVAL_GHOSTDIST_MIN_FACTOR = 0.85;
  27. public static final double EVAL_GHOSTDIST_AVER_FACTOR = 1 - EVAL_GHOSTDIST_MIN_FACTOR;
  28. public static final double EVAL_GHOSTMINDIST_ISOLATION = 1;
  29. public static final int EVAL_GHOST_BOOST = 2;
  30. public static final int EVAL_GHOSTBOOST_OFFSET = -25;
  31. public static final int EVAL_GHOST_TERRITORY = 6;
  32. public static final int EVAL_GHOSTTERRITORY_OFFSET = -50;
  33. // flags
  34. public static final int EVAL_FLAG_BOOST = 2;
  35. public static final int EVAL_FLAGBOOST_OFFSET = 25;
  36. /**
  37. * Evaluation mixing factor representing how much the individual
  38. * evaluation values(host, flag, torus) affect the final evaluation of the position
  39. */
  40. public static final double EVAL_GHOSTDIST_FACTOR = 0.65;
  41. public static final double EVAL_FLAGDIST_FACTOR = 0.40;
  42. public static final double EVAL_TORUSDIST_FACTOR = 0.04;
  43. /*
  44. * Tree settings
  45. */
  46. public static final int MINMAXTREE_MAX_DEPTH = 2; // MUST be multiple of 2
  47. /*
  48. * Maze setting
  49. */
  50. public static final int[] POSITION_FALSE = {-1, -1};
  51. public static final int DISTANCE_MAX = PacmanUtilities.numberOfRows + PacmanUtilities.numberOfColumns - 1;
  52. public static final int DISTANCE_FALSE = -1;
  53. public static final int FLAGDIST_MAX = 26; // add some for safety (lowers the gain)
  54. public static final int BORDERDIST_MAX = 12; // add some for safety (lowers the gain)
  55. /*
  56. * In order to find out when a creature is inside a cavity we manually
  57. * define the box limits of the cavity boxes of the current maze here
  58. * :)
  59. */
  60. public static final int BOXES[][][] = {
  61. { { 5, 5}, { 8, 8} },
  62. { { 5, 16}, { 8, 19} },
  63. { {11, 5}, {14, 8} },
  64. { {11, 16}, {14, 19} }
  65. };
  66. /**
  67. * Torus borders are the squares in the outer limits of the maze where
  68. * there are no walls. Pacman'a gravity can curve the maze plane to
  69. * a torus through these squares. This function check if a box is
  70. * a torus border box
  71. */
  72. public static final int TORUS_BORDERS[][] = {
  73. {0, 11},
  74. {0, 12},
  75. {0, 13},
  76. {9, 0},
  77. {9, 24},
  78. {10, 0},
  79. {10, 24},
  80. {19, 11},
  81. {19, 12},
  82. {19, 13},
  83. };
  84. /*
  85. * General algorithm constants
  86. */
  87. public static final int NO_PLACE = -1; // out of region square
  88. public static final int INVALID_MOVE = -1; // invalid move marker
  89. public static final int EVAL_MAX = 100; // out max evaluation value
  90. public static final int EVAL_MIN = 0; // our minimum evaluation value
  91. public static final int EVAL_FINAL_MAX = 100;
  92. public static final int EVAL_FINAL_MIN = -100;
  93. public static final int NO_EVAL = EVAL_FINAL_MIN-1; // mark the invalid on no evaluation
  94. }