/** * _update pac man. * * @param move the move */ private void _updatePacMan(MOVE move) { pacman.lastMoveMade = _correctPacManDir(move); pacman.currentNodeIndex = pacman.lastMoveMade == MOVE.NEUTRAL ? pacman.currentNodeIndex : laberintoActua.graph[pacman.currentNodeIndex].neighbourhood.get(pacman.lastMoveMade); }
/** _level reset. */ private void _levelReset() { fastamasComerMultiplicador = 1; _initGhosts(); pacman.currentNodeIndex = laberintoActua.initialPacManNodeIndex; pacman.lastMoveMade = MOVE.LEFT; }
/** * Returns an exact copy of the game. This may be used for forward searches such as minimax. The * copying is relatively efficient. * * @return the game */ public Game copy() { Game copy = new Game(); copy.seed = seed; copy.rnd = new Random(seed); copy.laberintoActua = laberintoActua; copy.pills = (BitSet) pills.clone(); copy.powerPills = (BitSet) powerPills.clone(); copy.indiceDeLaberinto = indiceDeLaberinto; copy.cuentaElLvl = cuentaElLvl; copy.tiempoLvlActual = tiempoLvlActual; copy.tiempoTotal = tiempoTotal; copy.score = score; copy.fastamasComerMultiplicador = fastamasComerMultiplicador; copy.juegoTerminado = juegoTerminado; copy.timeOfLastGlobalReversal = timeOfLastGlobalReversal; copy.pacmanFueComido = pacmanFueComido; copy.pastillaFueComida = pastillaFueComida; copy.pildoraPoderFueComida = pildoraPoderFueComida; copy.pacman = pacman.copy(); copy.fantasmaComido = new EnumMap<GHOST, Boolean>(GHOST.class); copy.fantasmas = new EnumMap<GHOST, Ghost>(GHOST.class); for (GHOST ghostType : GHOST.values()) { copy.fantasmas.put(ghostType, fantasmas.get(ghostType).copy()); copy.fantasmaComido.put(ghostType, fantasmaComido.get(ghostType)); } return copy; }
/** _update pac man extra life. */ private void _updatePacManExtraLife() { if (!pacman.hasReceivedExtraLife && score >= EXTRA_LIFE_SCORE) // award 1 extra life at 10000 points { pacman.hasReceivedExtraLife = true; pacman.numberOfLivesRemaining++; } }