예제 #1
0
 public boolean test(Game game) {
   int totalTime = game.getTotalTime();
   return (totalTime >= _min) && (totalTime <= _max);
 }
예제 #2
0
  public DataTuple(Game game, MOVE move) {
    if (move == MOVE.NEUTRAL) {
      move = game.getPacmanLastMoveMade();
    }

    this.DirectionChosen = move;

    this.mazeIndex = game.getMazeIndex();
    this.currentLevel = game.getCurrentLevel();
    this.pacmanPosition = game.getPacmanCurrentNodeIndex();
    this.pacmanLivesLeft = game.getPacmanNumberOfLivesRemaining();
    this.currentScore = game.getScore();
    this.totalGameTime = game.getTotalTime();
    this.currentLevelTime = game.getCurrentLevelTime();
    this.numOfPillsLeft = game.getNumberOfActivePills();
    this.numOfPowerPillsLeft = game.getNumberOfActivePowerPills();

    if (game.getGhostLairTime(GHOST.BLINKY) == 0) {
      this.isBlinkyEdible = game.isGhostEdible(GHOST.BLINKY);
      this.blinkyDist =
          game.getShortestPathDistance(
              game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.BLINKY));
    }

    if (game.getGhostLairTime(GHOST.INKY) == 0) {
      this.isInkyEdible = game.isGhostEdible(GHOST.INKY);
      this.inkyDist =
          game.getShortestPathDistance(
              game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.INKY));
    }

    if (game.getGhostLairTime(GHOST.PINKY) == 0) {
      this.isPinkyEdible = game.isGhostEdible(GHOST.PINKY);
      this.pinkyDist =
          game.getShortestPathDistance(
              game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.PINKY));
    }

    if (game.getGhostLairTime(GHOST.SUE) == 0) {
      this.isSueEdible = game.isGhostEdible(GHOST.SUE);
      this.sueDist =
          game.getShortestPathDistance(
              game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.SUE));
    }

    this.blinkyDir =
        game.getNextMoveTowardsTarget(
            game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.BLINKY), DM.PATH);
    this.inkyDir =
        game.getNextMoveTowardsTarget(
            game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.INKY), DM.PATH);
    this.pinkyDir =
        game.getNextMoveTowardsTarget(
            game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.PINKY), DM.PATH);
    this.sueDir =
        game.getNextMoveTowardsTarget(
            game.getPacmanCurrentNodeIndex(), game.getGhostCurrentNodeIndex(GHOST.SUE), DM.PATH);

    this.numberOfNodesInLevel = game.getNumberOfNodes();
    this.numberOfTotalPillsInLevel = game.getNumberOfPills();
    this.numberOfTotalPowerPillsInLevel = game.getNumberOfPowerPills();
  }