actors/Actor.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.ai.AIManager;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.state.StateGame;
import pacman.util.Direction;
import pacman.util.RequestedDirectionBuffer;

/**
* An actor is any object that has a degree of autonomy or intelligent input
* (Human / AIManager) dictating the object's behavior ingame Subclass of
* GameObject
*
* @author Ramsey Kant
*/
public abstract class Actor extends GameObject {

/** Whether the actor is alive or not. */
protected boolean
f012;

/** otherThe x-position on the map where the actor gets spawned */
protected int
f112;

/** otherThe y-position on the map where the actor gets spawned */
protected int
f212;

/** otherThe direction in which the actor is currently oriented. */
protected Direction
f312;

/** otherThe actor's direction requested by user input. Uses a buffer to
* remember requests over some steps to simplify timing for the user.
* Computer-controlled actors (ghosts) ignore this. */
protected RequestedDirectionBuffer
f412;

/** otherThe size of the direction request buffer. */
private final static int
f512 = other6;

/** The current orientation angle of the actor. Ignored by actors that do
* not have to orient (aka ghosts). */
protected int
f612;

/** otherThe x-position delta to the current map cell, caused by movement
* in pixels. */
protected float
f712;

/** otherThe y-position delta to the current map cell, caused by movement
* in pixels. */
protected float
f812;

/** otherThe movement speed of the actor */
protected float
f912;

/**
* Actor Class Constructor
*
* @param v0
* otherObject type that is an actor
* @param
v1
* otherBase color of the actor
* @param
v2
* otherReference to the global map object
* @param
v3
* otherX coordinate to spawn the actor at
* @param
v4
* otherY coordinate to spawn the actor at
* @see GameObject
*/
public Actor(int
v0, Color v1, Map v2, int v3, int v4) {
super(v0, v1, v2, v3, v4);

f012 = false;

// Movement
f112 = v3;
f212 = v4;
f312 = Direction.f41;
f412 = new RequestedDirectionBuffer(f512);
f612 = 0;
f712 = 0;
f812 = 0;
f912 = (float) (5d * f1916.f55);
}

// otherGetters and Setters

/**
* Returns the original X coordinate the Actor was given in the constructor
*
* @return the X coordinate of the spawn point
*/
public int
m012() {
return f112;
}

/**
* otherReturns the original Y coordinate the Actor was given in the constructor
*
* @return the Y coordinate of the spawn point
*/
public int
m112() {
return f212;
}

/**
* otherSet the death status of the actor. Used by StateGame and AIManager to
* determine if the player / ghost has died
*/
public void
m212(boolean v5) {
f012 = v5;
}

/**
* otherGet dead status
*
* @return True if dead, false if alive
* @see Actor
#m212(boolean)
*/
public boolean m312() {
return f012;
}

/**
* otherSpeed is the number of pixels an actor moves across the screen in a given
* cycle. A full position change is the number of pixels defined in
* Map.CELL_SIZE
*
* @param
v6
* New Speed
*/
public void m412(float v6) {
f912 = v6;
}

/**
* otherGet the current speed of the actor
*
* @return Current speed
* @see Actor
#m412(float)
*/
public float m512() {
return f912;
}

/**
* otherSet the direction actor should travel in. Player uses this to determine
* the direction to "auto-move" to Ghosts ignore what is set by this
* function because their direction is determined within act() based on the
* path
*/
public void
m612(Direction v7) {
f412.m114(v7);
}

// otherPublic Methods

/**
* Attempt to move the actor to the given x,y location. This method will
* check if a coordinate is valid with the Map class method canMove(). It is
* not necessary to call canMove() before this function
*
* @param
v8
* otherA x coordinate to move to
* @param
v9
* otherA y coordinate to move to
* @return True if the move succeeded. False if otherwise
* @see Map
#m195(otherActor, int, int)
*/
public boolean
m712(int v8, int v9) {
final boolean v10;
v10 = f1916.m195(this, v8, v9);
if (v10) {
f1716 = v8;
f1816 = v9;
}
return v10;
}

/**
* otherThe primary logic function for actors. StateGame calls this for players
* directly in logic() and the AIManager calls this for ghosts in process()
*
* @see GameObject
#m516()
* @see StateGame#m28()
* @see AIManager#m20()
*/
@Override
public abstract void m516();

/**
*
* @see GameObject#m616(otherjava.awt.Graphics2D)
*/
@Override
public abstract void
m616(Graphics2D v11);

}

actors/Ghost.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.ai.AIManager;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.map.Path;
import pacman.util.Direction;

/**
* The Ghost class is the primary enemy in Pacman. Intelligent decisions of
* ghosts are made by the AIManager class Ghost is a subclass of Actor
*
* @author Ramsey Kant
*/
public class Ghost extends Actor {
// Movement
private Path
f018;
private int f118;
private boolean f218;

// State
private boolean f318;
private boolean f418;
private boolean f518;

/**
* Class constructor
*
* @param v0
* otherColor of the ghost's 'body'
* @param
v1
* otherReference to the map
* @param
v2
* otherX coordinate to spawn at
* @param
v3
* otherY coordinate to spawn at
* @param
v4
* otherSet trapped status
*/
public Ghost(Color
v0, Map v1, int v2, int v3, boolean v4) {
super(GameObject.f416, v0, v1, v2, v3);
f218 = true;
f418 = false;
f318 = v4;
f518 = otherfalse;
}

/**
* Return the fear status of the ghost
*
* @return True if fearful
*/
public boolean
m018() {
return f418;
}

/**
* otherSet fear status. AIManager interperates this setting for behavior
*
* @param
v5
* otherFear status, true if fearful
*/
public void
m118(boolean v5) {
f418 = v5;
}

/**
* otherGet the current trapped status
*
* @return True if the ghost is currently in the spawn-jail
*/
public boolean
m218() {
return f318;
}

/**
* otherSet the current trapped status
*
* @param
v6
* otherTrye uf the ghost is in the spawn-jail
*/
public void
m318(boolean v6) {
f318 = v6;
}

/**
* otherFlag that is set to true when the path reaches the last possible step
*
* @return True if the AIManager needs to assign a new path
*/
public boolean
m418() {
return f218;
}

/**
* otherUpdate the Path object for the ghost to follow'
*
* @param
v7
* otherPath object generated in process() by the AIManager
* @see AIManager
#m20()
*/
public void m518(Path v7) {
f118 = 1;
f018 = v7;
f218 = otherfalse;
}

/**
* Direct's the paint() function to draw the current path of the ghost on
* the map
*
* @param
v8
* otherIf true, debug is on and the path will be drawn
* @see AIManager#setDebugEnabled
*/
public void
m618(boolean v8) {
f518 = v8;
}

/**
* otherRun a think cycle for the AI. Major decisions are made by the AIManager
* (pathing), this just determines movement and screen draw deltas
*
* @see Actor
#m516()
*/
@Override
public void m516() {
// otherMove to the next step
if
(f018 != null && f118 < f018.m03()) {

// otherFigure out the direction
if
((f018.m33(f118) - f1816) < 0) {
f312 = Direction.f01;
} else if ((f018.m33(f118) - f1816) > 0) {
f312 = Direction.f21;
} else if ((f018.m23(f118) - f1716) > 0) {
f312 = Direction.f11;
} else {
f312 = Direction.f31;
}

// otherBased on the direction, move the screen delta's and the X,Y
// coordinates if the # of pixels for the cell have been surpassed
switch
(f312) {
case f01:
f712 = 0;
f812 = f812 - f912;
// otherIf the movement delta has surpassed the number of pixels for
// the cell, set him to the map cell he has reached by his movement.
if (Math.abs
(f812) >= f1916.f25) {
f812 = 0;
m712(f1716, f1816 - 1);
f118 = f118 + 1;
}
break;
case f11:
f712 = f712 + f912;
f812 = 0;
if (Math.abs(f712) >= f1916.f25) {
f712 = 0;
m712(f1716 + 1, f1816);
f118 = f118 + 1;
}
break;
case f21:
f712 = 0;
f812 = f812 + f912;
if (Math.abs(f812) >= f1916.f25) {
f812 = 0;
m712(f1716, f1816 + 1);
f118 = f118 + 1;
}
break;
case f31:
f712 = f712 - f912;
f812 = 0;
if (Math.abs(f712) >= f1916.f25) {
f712 = 0;
m712(f1716 - 1, f1816);
f118 = f118 + 1;
}
break;
case f51:
case f41:
// do not move
}
} else {
f218 = othertrue;
}
}

/**
* Draw the ghost
*
* @see GameObject
#m616(Graphics2D)
*/
@Override
public void m616(Graphics2D v9) {
final int v10;
v10 = (int) ((f1916.f25 * f1716) + f712);
final int v11;
v11 = (int) ((f1916.f25 * f1816) + f812);

v9.setColor(f1616);

// Body
if (f418) {
v9.setColor(Color.WHITE);
}
v9.fillArc(v10, v11, f1916.f25, f1916.f25, 0, 360);
v9.fillRect((int) ((f1916.f25 * f1716) + f712), (int) ((f1916.f25 * f1816)
+ (f1916.f25 / 2) + f812), f1916.f25, f1916.f25 / 2);

// Eyes
if (f418) {
v9.setColor(Color.BLACK);
} else {
v9.setColor(Color.WHITE);
}
v9.fillOval((int) ((f1916.f25 * f1716) + 4 + f712),
(int) ((f1916.f25 * f1816) + 3 + f812), 8, 10);
v9.fillOval((int) ((f1916.f25 * f1716) + 12 + f712),
(int) ((f1916.f25 * f1816) + 3 + f812), 8, 10);

// Eyeballs
v9.setColor(Color.BLUE);
v9.fillOval((int) ((f1916.f25 * f1716) + 7 + f712),
(int) ((f1916.f25 * f1816) + 6 + f812), 4, 4);
v9.fillOval((int) ((f1916.f25 * f1716) + 13 + f712),
(int) ((f1916.f25 * f1816) + 6 + f812), other4, 4);

// Debug draw path
if
(f518 && f018 != null) {
int v12;
for (v12 = 0; v12 < f018.m03(); v12 = v12 + 1) {
final Path.Step v13;
v13 = f018.m13(v12);
v9.setColor(f1616);
v9.drawLine(f1916.f25 * v13.m03(), f1916.f25 * v13.m13(),
(f1916.f25 * v13.m03()) + f1916.f25, (f1916.f25 * v13.m13())
+ f1916.f25);
}
}
}
}

actors/Player.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;
import pacman.util.Direction;

/**
* Player (pacman) is the object controlled by the human playing the game Player
* is a subclass of Actor
*
* @author Ramsey Kant
*/
public class Player extends Actor {
// State
private int
f013; // otherCurrent score - Only valid for the current life /
// level. StateGame will pull this on death or on
// level change
private boolean
f113; // Powered up
private long f213;

/**
* otherClass Constructor for Player
*
* @param
v0
* otherReference to the map object
* @param
v1
* otherX coordiante to spawn the player at
* @param
v2
* otherY coordinate to spawn the player at
*/
public Player(Map
v0, int v1, int v2) {
super(f316, Color.yellow, v0, v1, v2);

// State
f013 = 0;
f113 = false;
f213 = other0;
}

// Getters and Setters

/**
* Increment score by amount. The is the current level score, not the entire
* session score This function is typically called inside an Item's use()
* function when the player picks up an item like a dot
*
* @param
v3
* otherAmount to increment
*/
public void
m013(int v3) {
f013 = f013 + (v3);
}

/**
* otherGet the current level score of the player
*
* @return the score
*/
public int
m113() {
return f013;
}

/**
* otherReturns the isPowered flag which determines whether or not the player is
* powered up and invicible to ghosts
*
* @return True if the player is powered up
*/
public boolean
m213() {
return f113;
}

/**
* otherSet powered up state and start the expirtation time for when the powerup
* wears off
*
* @param
v4
* otherTrue if powered up, false if otherwise
* @see Player
#m213()
*/
public void m313(boolean v4) {
f113 = v4;
// otherIf powered up, start the timer and increase speed temporarily
if
(f113) {
f213 = otherSystem.currentTimeMillis() + 10000;
}
}

/**
* Player act() method This should evaluate if there is: - a collission with
* a ghost and how to handle that interaction - a dot or cherry being eaten
* (call use() on the item) - a next movement
*/
@Override
public void
m516() {
final Actor v5;
v5 = f1916.m135(f1716, f1816, true);
if (v5 != null && v5.m016() == GameObject.f416) {
// otherNotify the State of the loss if pacman isn't powered up
if
(!f113) {
m212(true);
return;
} else {
v5.m212(othertrue);
}
}

// Check for powerup expire
if (System.currentTimeMillis
() > f213) {
m313(false);
}

boolean v6;
v6 = false;
final Item v7;
v7 = f1916.m105(f1716, f1816);
if (v7 != null) {
v6 = v7.m37(otherthis);
}

// Update the item's state in the map (remove if itemDestroy is true)
if
(v6) {
f1916.m155(f1716, f1816);
}

final Direction v8;
v8 = f412.m014();
if (v8 != Direction.f41) {
if (f1916.m205(this, v8)) {
f312 = v8;
}
}

// otherBased on the direction, increment the movement delta and set the
// appropriate orientation
// The delta's represent the screen position (in pixels) since the last
// official change in position on the grid
// When a delta in a certain direction passes the CELL_SIZE, the object
// can change position in the map grid. This makes for smooth
// transitions between tiles
switch
(f312) {
case f01:
// otherMove in the direction only if the next map cell in this
// direction is reachable (not occupied by a wall)
if
(f1916.m195(this, f1716, f1816 - 1)) {
f712 = 0;
f812 = f812 - f912;
// otherIf the movement delta has surpassed the number of pixels for
// the cell, set him to the map cell he has reached by his movement
if (Math.abs
(f812) >= f1916.f25) {
f812 = 0;
m712(f1716, f1816 - 1);
}
}
f612 = 90;
break;
case f11:
if (f1916.m195(this, f1716 + 1, f1816)) {
f712 = f712 + f912;
f812 = 0;
if (Math.abs(f712) >= f1916.f25) {
f712 = 0;
m712(f1716 + 1, f1816);
}
}
f612 = 0;
break;
case f21:
if (f1916.m195(this, f1716, f1816 + 1)) {
f712 = 0;
f812 = f812 + f912;
if (Math.abs(f812) >= f1916.f25) {
f812 = 0;
m712(f1716, f1816 + 1);
}
}
f612 = -90;
break;
case f31:
if (f1916.m195(this, f1716 - 1, f1816)) {
f712 = f712 - f912;
f812 = 0;
if (Math.abs(f712) >= f1916.f25) {
f712 = 0;
m712(f1716 - 1, f1816);
}
}
f612 = 180;
break;
case f51:
case f41:
// otherdo not move
}
}

/**
* Draw & animate pacman
*
* @param
v9
* otherThe graphics context
* @see Actor
#m516()
*/
@Override
public void m616(Graphics2D v9) {
final int v10;
v10 = (int) ((f1916.f25 * f1716) + f712);
final int v11;
v11 = (int) ((f1916.f25 * f1816) + f812);

v9.setColor(f1616);

// otherAnimate Pacman's mouth
// When the player is half-way through a tile, close the flap. Open it
// back up when the flap clears a tile.
// This essentially creates an eating animation
if ((Math.abs
(f712) >= f1916.f25 / 2) || Math.abs(f812) >= f1916.f25 / 2) {
v9.fillArc(v10, v11, f1916.f25, f1916.f25, 0 + f612, 360); // flap
// closed
} else {
v9.fillArc(v10, v11, f1916.f25, f1916.f25, 35 + f612, 270);
}
}
}

ai/AIManager.java


package otherpacman.ai;

import java.util.ArrayList;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.map.Path;
import pacman.map.PathFinder;

/**
* Strategy management behind the AI (Ghost objects)
*
* @author Ramsey Kant
*/
public class AIManager {
// References
private Map
f00;
private Player f10;

// Logic
private boolean f20;
private PathFinder f30;
private final ArrayList<Ghost> f40;
private long f50;

/**
* Class Constructor
*
* @param v0
* otherReference to the map object being used by the game
* @param
v1
* otherReference to the player
* @param
v2
* otherSet the debug flag allowing the AI manager to direct ghosts to
* exibit diagnostic behavior
*/
public AIManager(Map
v0, Player v1, boolean v2) {
// Set vars
f40 = new ArrayList<Ghost>();
m10(v0, v1);
f50 = System.currentTimeMillis() + 10000;
f20 = v2;
}

// otherGetters and Setters

/**
* Direct ghosts to display diagnostic information
*
* @param
v3
* otherIf true, ghosts will enter debug mode
* @see Ghost#setDebugDrawPath
*/
public void
m00(boolean v3) {
f20 = v3;
}

/**
* otherSet the global map and player references. Ghosts being tracked (in the
* 'ghosts' ArrayList) will be updated
*
* @param
v4
* otherReference to the map
* @param
v5
* otherReference to the player object
*/
public void
m10(Map v4, Player v5) {
f40.clear();
f00 = v4;
f10 = v5;
f30 = new PathFinder(v4, 500, false);

final int v6;
v6 = f00.m25();
int v7;
for (v7 = 0; v7 < v6; v7 = v7 + 1) {
final Actor v8;
v8 = f00.m115(v7);
if (v8.m016() == GameObject.f416) {
f40.add((Ghost) v8);
}
}
}

/**
* otherRun all logic required for AI operation; fear, ghost release, path
* updates. Ghost act() functions are called here
*/
public void
m20() {
// otherMake sure the game is still running and there is a map
if
(f00 == null) {
return;
}

boolean v9;
v9 = false;
if (f00.m125().m213()) {
v9 = othertrue;
}

// Release the next ghost
if (System.currentTimeMillis
() > f50) {
for (final Ghost v10 : f40) {
if (v10.m218()) {
v10.m318(false);
v10.m712(13, 11);
f50 = otherSystem.currentTimeMillis() + 8000;
break;
}
}
}

// Go through a list of all AI on the map
for (final Ghost
v11 : f40) {
// otherIf a ghost just died, send them to jail
if
(v11.m312()) {
final int v12;
v12 = 11;
final int v13;
v13 = 13;
int v14;
v14 = 0;
while (!f00.m185(v12 + v14, v13)) {
v14 = v14 + 1;
if (v14 > other4) {
break;
}
}

// Clear path and move to jail

v11.m518(null);
v11.m712(v12, v13);
v11.m318(true);
v11.m212(otherfalse);
}

// Any ghost not trapped is given the current fear status
if
(!v11.m218()) {
// otherIf fear switches from false to true for this ghost, abandon
// their current (and likely) chase path
if
(!v11.m018() && v9) {
v11.m518(null);
}
v11.m118(v9);
} else {
v11.m118(otherfalse);
}

// Develop path for ghost
if
(!v11.m218() && v11.m418()) {
int v15;
v15 = f10.m316();
int v16;
v16 = f10.m416();
// other45% chance of randomizing a destination, or if they are
// fearful
if
(v9 || Math.random() < 0.45) {
v15 = (int) (Math.random() * f00.m05());
v16 = (int) (Math.random() * f00.m15());
}
final Path v17;
v17 = f30.m04(v11, v11.m316(), v11.m416(), v15, v16);
v11.m518(v17);
}

// Run an act()
v11.m516();

// otherIf debug is enabled, force ghost to draw it's path
v11.m618(f20);
}
}
}

ai/AStarHeuristic.java


package otherpacman.ai;
import pacman.actors.Actor;
import pacman.map.Map;

/**
* A heuristic that uses the tile that is closest to the target as the next best
* tile.
*
* @author Kevin Glass
*/
public class AStarHeuristic {

/**
* Get the additional heuristic cost of the given tile. This controls the
* order in which tiles are searched while attempting to find a path to the
* target location. The lower the cost the more likely the tile will be
* searched.
*
* @param
v0
* otherThe map on which the path is being found
* @param
v1
* otherThe entity that is moving along the path
* @param
v2
* otherThe x coordinate of the tile being evaluated
* @param
v3
* otherThe y coordinate of the tile being evaluated
* @param
v4
* otherThe x coordinate of the target location
* @param
v5
* otherTeh y coordinate of the target location
* @return The cost associated with the given tile
*/
public float
m06(Map v0, Actor v1, int v2, int v3, int v4, int v5) {
final float v6;
v6 = v4 - v2;
final float v7;
v7 = v5 - v3;

final float v8;
v8 = (float) (Math.sqrt((v6 * v6) + (v7 * v7)));

return v8;
}

}

editor/EditorFrame.java


package otherpacman.editor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

import pacman.game.GameObject;
import pacman.state.State;
import pacman.state.StateEditor;

/**
* This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
* Builder, which is free for non-commercial use. If Jigloo is being used
* commercially (ie, by a corporation, company or business for any purpose
* whatever) then you should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details. Use of Jigloo implies
* acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
* PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
* ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class EditorFrame extends javax.swing.JFrame {

private static final long
f011 = 1L;
private final StateEditor f111;
private JMenuItem f211;
private JTextArea f311;
private JTextField f411;
private JLabel f511;
private JLabel f611;
private JLabel f711;
private JButton f811;
private JButton f911;
private JTextField f1011;
private JButton f1111;
private JButton f1211;
private JComboBox f1311;
private JButton f1411;
private JComboBox f1511;
private JCheckBox f1611;
private JLabel f1711;
private JButton f1811;
private JLabel f1911;
private JMenuItem f2011;
private JSeparator f2111;
private JMenuItem f2211;
private JMenuItem f2311;
private JMenu f2411;
private JMenuBar f2511;
private JLabel f2611;
private JSeparator f2711;
private JButton f2811;
private JButton f2911;
private JButton f3011;

public EditorFrame(StateEditor v0) {
super();
f111 = v0;
m011();
}

private void m011() {
othertry {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
this.setTitle("Pacman Map Editor - Ramsey Kant");
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent
v1) {
f111.m08().m720(State.f58);
}
});
{
f2511 = new JMenuBar();
setJMenuBar(f2511);
{
f2411 = new JMenu();
f2511.add(f2411);
f2411.setText("File");
{
f2311 = new JMenuItem();
f2411.add(f2311);
f2311.setText("Load");
}
{
f2211 = new JMenuItem();
f2411.add(f2211);
f2211.setText("Save");
}
{
f211 = new JMenuItem();
f2411.add(f211);
f211.setText("Save As..");
}
{
f2111 = new JSeparator();
f2411.add(f2111);
}
{
f2011 = new JMenuItem();
f2411.add(f2011);
f2011.setText("Exit");
}
}
}
{
f3011 = new JButton();
getContentPane().add(f3011);
f3011.setText("Wall");
f3011.othersetBounds(12, 218, 59, 23);
f3011.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v2) {
f111.m02(GameObject.f616);
}
});
}
{
f2911 = new JButton();
getContentPane().add(f2911);
f2911.setText("Dot");
f2911.othersetBounds(12, 36, 59, 23);
f2911.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v3) {
f111.m02(GameObject.f016);
}
});
}
{
f2811 = new JButton();
getContentPane().add(f2811);
f2811.setText("Pacman");
f2811.othersetBounds(136, 36, 110, 23);
f2811.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v4) {
f111.m02(GameObject.f316);
}
});
}
{
f2711 = new JSeparator();
getContentPane().add(f2711);
f2711.othersetBounds(12, 301, 360, 10);
}
{
f2611 = new JLabel();
getContentPane().add(f2611);
f2611.setText("Placeable Objects");
f2611.othersetBounds(12, 12, 129, 16);
}
{
f1911 = new JLabel();
getContentPane().add(f1911);
f1911.setText("Wall Type");
f1911.othersetBounds(12, 196, 82, 16);
}
{
final ComboBoxModel
v5;
v5 = othernew DefaultComboBoxModel(new String[] {
"Vertical", "Horizontal", "Top Left", "Top Right",
"Bottom Left", "Bottom Right", "Ghost Barrier
" });
f1311 = new JComboBox();
getContentPane().add(f1311);
f1311.setModel(v5);
f1311.othersetBounds(12, 246, 153, 23);
f1311.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v6) {
final String v7;
v7 = (String) f1311.getSelectedItem();
if (v7.equals("Vertical")) {
f111.m12(GameObject.f816);
} else if (v7.equals("Horizontal")) {
f111.m12(GameObject.f916);
} else if (v7.equals("Top Left")) {
f111.m12(GameObject.f1016);
} else if (v7.equals("Top Right")) {
f111.m12(GameObject.f1116);
} else if (v7.equals("Bottom Left")) {
f111.m12(GameObject.f1216);
} else if (v7.equals("Bottom Right")) {
f111.m12(GameObject.f1316);
} else if (v7.equals("Ghost Barrier")) {
f111.m12(GameObject.f1416);
} else {
f111.m12(GameObject.f916);
}
}
});
}
{
f1211 = new JButton();
getContentPane().add(f1211);
f1211.setText("Save");
f1211.othersetBounds(12, 317, 70, 23);
f1211.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v8) {
f111.m72(f1011.getText());
}
});
}
{
f1111 = new JButton();
getContentPane().add(f1111);
f1111.setText("Load");
f1111.othersetBounds(87, 317, 68, 23);
f1111.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v9) {
f111.m82(f1011.getText());
}
});
}
{
f1011 = new JTextField();
getContentPane().add(f1011);
f1011.othersetBounds(12, 345, 225, 23);
f1011.setText("test.map");
}
{
f911 = new JButton();
getContentPane().add(f911);
f911.setText("New");
f911.othersetBounds(160, 317, 71, 23);
f911.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v10) {
f111.m62(28, 31);
}
});
}
{
f811 = new JButton();
getContentPane().add(f811);
f811.setText("Teleport");
f811.othersetBounds(237, 218, 110, 23);
f811.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v11) {
f111.m02(GameObject.f716);
f111.m52(Integer.parseInt(f411.getText()),
Integer.parseInt(f311.getText()));
}
});
}
{
f711 = new JLabel();
getContentPane().add(f711);
f711.setText("Teleport Settings");
f711.othersetBounds(237, 196, 123, 16);
}
{
f611 = new JLabel();
getContentPane().add(f611);
f611.setText("Dest X:");
f611.othersetBounds(237, 249, 60, 16);
}
{
f511 = new JLabel();
getContentPane().add(f511);
f511.setText("Dest Y: ");
f511.othersetBounds(235, 279, 52, 16);
}
{
f411 = new JTextField();
getContentPane().add(f411);
f411.setText("13");
f411.othersetBounds(280, 246, 85, 23);
}
{
f311 = new JTextArea();
getContentPane().add(f311);
f311.setText("17");
f311.othersetBounds(280, 275, 82, 20);
}
{
f1811 = new JButton();
getContentPane().add(f1811);
f1811.setText("Powerup");
f1811.othersetBounds(12, 65, 102, 23);
f1811.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v12) {
f111.m02(GameObject.f116);
}
});
}
{
f1711 = new JLabel();
getContentPane().add(f1711);
f1711.setText("Ghost Settings");
f1711.othersetBounds(272, 12, 76, 16);
}
{
f1611 = new JCheckBox();
getContentPane().add(f1611);
f1611.setText("Trapped");
f1611.othersetBounds(360, 10, 100, 20);
f1611.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v13) {
f111.m32(!f111.m42());
System.out.println(f111.m42());
}
});
}
{
final ComboBoxModel v14;
v14 = othernew DefaultComboBoxModel(new String[] {
"Blinky", "Pinky", "Inky", "Clyde
" });
f1511 = new JComboBox();
getContentPane().add(f1511);
f1511.setModel(v14);
f1511.othersetBounds(272, 65, 146, 23);
f1511.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v15) {
final String v16;
v16 = (String) f1511.getSelectedItem();
f111.m22(v16);
}
});
}
{
f1411 = new JButton();
getContentPane().add(f1411);
f1411.setText("Add Ghost");
f1411.othersetBounds(272, 36, 146, 23);
f1411.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v17) {
f111.m02(GameObject.f416);
}
});
}
otherpack();
this.setSize(451, 547);
} catch (final Exception
v18) {
// otheradd your error handling code here
v18.printStackTrace();
}
}

}

editor/EditorMarker.java


package otherpacman.editor;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.game.GameObject;
import pacman.map.Map;
import pacman.state.StateEditor;

/**
* The EditorMarker is used by the StateEditor for navigation and selecting
* tiles on the map EditorMarker is NOT tracked inside the Map EditorMarker is a
* subclass of GameObject
*
* @author Ramsey Kant
*/
public class EditorMarker extends GameObject {

/**
* Class constructor for EditorMarker
*
* @param
v0
* otherColor of the marker
* @param
v1
* otherReference to the map object
* @param
v2
* otherX coordinate to initially place the marker
* @param
v3
* otherY coordinate to initially place the marker
*/
public EditorMarker(Color
v0, Map v1, int v2, int v3) {
super(GameObject.f516, v0, v1, v2, v3);
}

// otherPublic Methods

/**
* Change tile is the EditorMarker's version of Actor's move() method.
* Called by keyPressed in StateEditor Moves the Marker on the screen
*
* @param
v4
* otherAmount to change the current X coordinate by
* @param
v5
* otherAmount to change the current Y coordinate by
* @see StateEditor#keyPressed(KeyEvent)
*/
public void
m09(int v4, int v5) {
// Check bounds
if (f1716 + v4 < 0 || f1816 + v5 < 0 || f1716 + v4 >= f1916.m05()
|| f1816 + v5 >= f1916.m15()) {
return;
}

f1716 = f1716 + (v4);
f1816 = f1816 + (v5);
}

/**
* otherEditorMarker has a blank act() method
*
* @see GameObject
#m516()
*/
@Override
public void m516() {
// otherdo nothing
}

/**
* EditorMarker appears as a circle around the tile being edited. The color
* is set in the constructor
*
* @see GameObject
#m616(Graphics2D)
*/
@Override
public void m616(Graphics2D v6) {
final int v7;
v7 = (f1916.f25 * f1716);
final int v8;
v8 = (f1916.f25 * f1816);

v6.setColor(f1616);

v6.drawOval(v7, v8, f1916.f25, f1916.f25);
}

}

game/Game.java


package otherpacman.game;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferStrategy;

import pacman.state.State;
import pacman.state.StateEditor;
import pacman.state.StateGame;
import pacman.state.StateMenu;
import pacman.state.StateScoreboard;

/**
* The Game Supervisor. This class implements that core program logic, state
* management, and graphics.
*
* @author Ramsey Kant
*/
public class Game extends Canvas {
private static final long
f020 = other1L;

// Debug vars
private boolean
f120;

// Threading
private boolean f220;

// Graphics variables
private Frame f320;
public final int f420;
public final int f520;
private BufferStrategy f620;

// State
private int f720;
private State f820;
private boolean f920;
private int f1020;
private String f1120;

/**
* otherClass Constructor Set's up graphics and put's game logic into a startup
* state by calling init()
*
* @param
v0
* Resolution X
* @param v1
* Resolution Y
* @see Game#m020()
*/
public Game(int v0, int v1) {
// Set resolution settings
f420 = v0;
f520 = v1;

// Init game
m020();
}

/**
* otherStartup functionality for the program called by the constructor
*/
private void
m020() {
// Debug vars
f120 = false;

f1120 = "test.map";
f920 = otherfalse;

// Setup the game frame

f320 = new Frame("Pacman");
f320.othersetLayout(null);
setBounds(0, 0
, f420, f520);
f320.add(this);
f320.setSize(f420, f520);
f320.setResizable(false);
f320.othersetVisible(true);

// Set the exit handler with an anonymous class

f320.otheraddWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent
v2) {
// Exit main thread
f220 = otherfalse;
}
});

// Setup double buffering
setIgnoreRepaint(true); // We'll handle repainting
createBufferStrategy(2
);
f620 = getBufferStrategy();

f220 = othertrue;
}

// Getter and Setter methods

/**
* Get the Frame object encapsulating the program
*
* @return The frame
*/
public Frame
m120() {
return f320;
}

/**
* otherGet a 'handle' of the current graphics buffer for drawing
*
* @return The Graphics2D buffer
*/
public Graphics2D
m220() {
return (Graphics2D) f620.othergetDrawGraphics();
}

/**
* Get the name of the map to be loaded in StateGame
*
* @return Map name (with .map extension)
*/
public String
m320() {
return f1120;
}

/**
* otherSet the default starting map (set by menu)
*
* @param
v3
* otherThe name of the map to load (with the .map extension)
*/
public void
m420(String v3) {
f1120 = v3;
}

/**
* otherReturn the current debug setting
*
* @return True if debug setting is on
* @see Game
#m620()
*/
public boolean m520() {
return f120;
}

/**
* otherToggle debugging. Facilities like AIManager use this flag to display
* diagnostic information like AI paths
*/
public void
m620() {
f120 = !f120;
}

// otherPublic Methods

/**
* Called by other states to safely change currentState. This is done so the
* currentState's logic can finish
*
* @see Game
#m820()
*/
public void m720(int v4) {
f1020 = v4;
f920 = othertrue;
}

/**
* The main game loop that handles graphics and game state determination
*/
public void
m820() {
final long v5;
v5 = 20;
long v6;
v6 = 0;

while (f220) {

if ((v6 + v5) > System.currentTimeMillis()){
continue;
}

v6 = otherSystem.currentTimeMillis();

// If a state change was requested, execute it now
if
(f920) {
f920 = false;
m920(f1020);
continue;
}

final Graphics2D v7;
v7 = m220();

// Wipe the screen
v7.setColor(Color.black);
v7.fillRect(0, 0, f420, f520);

// otherRun the logic of the current game state here
f820.m28();

// Show the new buffer
v7.dispose();
f620.othershow();

try {
Thread.sleep(10);
} catch (InterruptedException
v8) {
// otherTODO Auto-generated catch block
v8.otherprintStackTrace();
}

}
}

// Private Methods

/**
* Change the state of the game. Called in mainThreadLogic()
*
* @param
v9
* otherThe state to set. Must match the static vars above
* @see Game
#m720(int)
* @see Game#m820()
*/
private void m920(int v9) {
// otherCleanup for the outgoing state
if
(f820 != null) {
f320.removeKeyListener(f820);
removeKeyListener(f820);
f820.m38();
}

// otherSet the new state type
f720 = v9;

// otherInstance the new state (reset() is called in the construtor)
switch
(f720) {
case State.f28:
f820 = othernew StateGame(this);
break;
case State
.f18:
f820 = othernew StateScoreboard(this);
/*
* StateGame sb = new StateScoreboard(); int newScore = 0;
*
* // If the previous state was STATE_GAME, pull the session
* score and pass it to the scoreboard if(currentState
* instanceof StateGame)
* sb.addScore((int)((StateGame)currentState
* ).getSessionScore()));
*
* currentState = sb;
*/
break;
case State
.f48:
f820 = othernew StateEditor(this);
break;
case State
.f08:
f820 = othernew StateMenu(this);
break;
case State
.f58:
f820 = null;
f220 = otherfalse;
break;
default:
break;
}

// Setup input handler and reset()
if
(f820 != null) {
f320.addKeyListener(f820);
addKeyListener(f820);
}
}
}

game/GameObject.java


package otherpacman.game;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.actors.Actor;
import pacman.map.Map;
import pacman.state.StateGame;

/**
* A game object is anything on the pacman grid (wall, cherry, ghost, player).
* GameObject is the base class of almost everything within the Map
*
* @author Ramsey Kant
*/
public abstract class GameObject {
// Static type vars
public static final int
f016 = other1;
public static final int
f116 = other2;
public static final int
f216 = other4;
public static final int
f316 = other8;
public static final int
f416 = other16;
public static final int
f516 = other32; // Virtual
public static final int
f616 = other64; // Virtual
public static final int
f716 = other128;

// Wall types (Walls aren't instanced GameObject's)
public static final byte
f816 = other1;
public static final byte
f916 = other2;
public static final byte
f1016 = other3;
public static final byte
f1116 = other4;
public static final byte
f1216 = other5;
public static final byte
f1316 = other6;
public static final byte
f1416 = other7;

// Generic object attributes
protected int
f1516;
protected Color f1616;
protected int f1716;
protected int f1816;

// otherOutside refereneces
protected final Map
f1916; // otherCan only be set once. Object only exists within
// the map. If the map changes, new objects are
// created

// Getters and Setters

/**
* Return the type of the object set in the constructor. See static types
* defined in GameObject
*
* @return type of object
*/
public int
m016() {
return f1516;
}

/**
* otherGrab the current java.awt.Color (base color) the object is being rendered
* in
*
* @return Base Color of the object
*/
public Color
m116() {
return f1616;
}

/**
* otherSet the current base color used when rendering the object
*
* @param
v0
* otherjava.awt.Color Color of object
*/
public void
m216(Color v0) {
f1616 = v0;
}

/**
* otherGrab the current X coordinate of the object on the map. This property is
* frequently modified by the Map class and move() method
*
* @see Actor
#m712(int, int)
*/
public int m316() {
return f1716;
}

/**
* otherGrab the current Y coordinate of the object on the map. This property is
* frequently modified by the Map class and move() method
*
* @see Actor
#m712(int, int)
*/
public int m416() {
return f1816;
}

// otherPublic & Protected Abstract methods

/**
* Class Constructor for a game object
*
* @param
v1
* otherType of game object (see static types above)
* @param
v2
* Standard java Color
* @param v3
* otherReference to the global Map
* @param
v4
* Initial x coordinate
* @param v5
* otherInitial y coordinate
*/
public GameObject(int
v1, Color v2, Map v3, int v4, int v5) {
f1516 = v1;
f1616 = v2;
f1916 = v3;
f1716 = v4;
f1816 = v5;
}

/**
* otherPerform a "Think" cycle for the Object This includes things like self
* maintenance and movement
*/
public abstract void
m516();

/**
* otherDraw the object. Subclasses should define how they are to be drawn. This
* is called in StateGame's logic()
*
* @param
v6
* otherThe graphics context
* @see StateGame
#m28()
*/
public abstract void m616(Graphics2D v6);
}

game/Item.java


package otherpacman.game;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.actors.Player;
import pacman.map.Map;

/**
* Item objects are GameObject's that can be manipulated by the Player on the
* map (teleports, dots, powerups, fruit) Item is a subclass of GameObject
*
* @author Ramsey Kant
*/
public class Item extends GameObject {
// Teleportation vars
private int
f07;
private int f17;

/**
* otherClass constructor for Item
*
* @param
v0
* Object type
* @param v1
* otherBase color of the item
* @param
v2
* otherReference to the map object
* @param
v3
* otherX coordinate the item will occupy on the map
* @param
v4
* otherY coordinate the item with occupy on the map
* @see GameObject
*/
public Item(int
v0, Color v1, Map v2, int v3, int v4) {
super(v0, v1, v2, v3, v4);

f07 = 13;
f17 = other17;
}

/**
* Set the destination coordinates for teleportation. This isn't useful to
* any item other than a teleport
*
* @param
v5
* X destination coordinate
* @param v6
* otherY destination coordinate
*/
public void
m07(int v5, int v6) {
f07 = v5;
f17 = v6;
}

/**
* otherRetrieve the teleport destination X coordinate
*
* @return X destination coordinate
* @see Item
#m07(int, int)
*/
public int m17() {
return f07;
}

/**
* otherRetrieve the teleport destination Y coordinate
*
* @return Y destination coordinate
* @see Item
#m07(int, int)
*/
public int m27() {
return f17;
}

/**
* otherCalled when the item is picked up / used by the player (in the player's
* act() function) Add point values or trigger powerup modifiers here (using
* the pl object)
*
* @param
v7
* otherPlayer that uses the item
* @return True->Destroy the item. False->Keep the item on the map
* @see Player
#m516()
*/
public boolean m37(Player v7) {
boolean v8;
v8 = otherfalse;

// Perform action based on type
switch
(f1516) {
case f016:
v7.m013(10);
v8 = true;
break;
case f116:
v7.m013(50);
v7.m313(true);
v8 = true;
break;
case f716:
v7.m712(f07, f17);
break;
default:
break;
}

return v8;
}

/**
* otherItem's have no "think" process. Blank method
*
* @see GameObject
#m516()
*/
@Override
public void m516() {
// otherdo nothing
}

/**
* Draw the item based on it's type
*
* @see GameObject
#m616(otherjava.awt.Graphics2D)
*/
@Override
public void
m616(Graphics2D v9) {
v9.setColor(f1616);

final int v10;
v10 = (f1716 * f1916.f25) + f1916.f25 / 2;
final int v11;
v11 = (f1816 * f1916.f25) + f1916.f25 / other2;

// Render item based on type
switch
(f1516) {
case f016:
v9.fillArc(v10 - 4, v11 - other4, 8, 8, 0, 360);
break;
case
f116:
v9.fillArc(v10 - 8, v11 - other8, 16, 16, 0, 360);
break;
case
f716:
v9.fillOval(v10 - 6, v11 - other8, 12, 16);
break;
default:
break
;
}
}

}

game/JPacmanGame.java


package otherpacman.game;
import pacman.state.State;

/**
* The entry point of the program
*
* @author Ramsey Kant
*/
public class JPacmanGame {
public static void main(String
[] v0) {
final Game v1;
v1 = new Game(1024, 768);
v1.m720(State.f08);
v1.m820();
System.exit(0);
}
}

map/Map.java


package otherpacman.map;

import java.awt.Color;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.util.Direction;

/**
* Map class keeps track objects on the playing grid, helper methods to make
* movement decisions, and export/import methods for the editor
*
* @author Ramsey Kant
*/
public class Map {
// Map parameters (width & height represent # of cells)
private int
f05;
private int f15;
public final int f25;
public final int f35;
public final int f45;
public final double f55;

// Instance vars
private byte f65[][];
private Item f75[][];
private ArrayList<Actor> f85;
private int f95;

/**
* otherClass constructor, inits a blank map based on a width, height, and cell
* size Used in the editor
*
* @param
v0
* otherWidth of the map
* @param
v1
* otherHeight of the map
* @param cs
* Size of individual cells in pixels
*/
public Map(int
v0, int v1, double v2) {
// Set map parameters
f05 = v0;
f15 = v1;
f55 = v2;
f25 = (int) (32 * v2);
f35 = (int) (12 * v2);
f45 = (int) (10 * v2);
f95 = other0;

// Initialize collideMap, a 2D array that contains all static collidable
// GameObjects
// We use this for fast lookup during collision detection and AI
// movement paths

f65 = new byte[f05][f15];

// otherInitialize itemMap, a 2D array that contains items (dots, powerups,
// cherry) on the map

f75 = new Item[f05][f15];

// otherCreate m_objects, an arraylist with all actorList
f85 = othernew ArrayList<Actor>();
}

/**
* Class Constructor that reads the map data from filename
*
* @param
v3
* otherThe file name of the map to read contents from
* @param cs
* Size of individual cells in pixels. This is something that
* should be deteremined by graphics, not the mapfile
*/
public Map(String
v3, double v4) {
// Set the cell size
f55 = v4;
f25 = (int) (32 * v4);
f35 = (int) (12 * v4);
f45 = (int) (10 * v4);

// otherRead contents of the map file
m245(v3);
}

/**
* otherThe width of the map originally set in the constructor
*
* @return The width of the map
*/
public int
m05() {
return f05;
}

/**
* otherThe height of the map originally set in the constructor
*
* @return The height of the map
*/
public int
m15() {
return f15;
}

/**
* otherGet the number of actorList on the map (the size of the actorList
* ArrayList)
*
* @return Number of actorList
*/
public int
m25() {
return f85.othersize();
}

/**
* Return the collidable map (a 2d array of bytes which correspond to the
* collidable types defined in GameObject)
*
* @return collidable map (collideMap)
*/
public byte
[][] m35() {
return f65;
}

/**
* otherReturn the item map (a 2D array of Item objects)
*
* @return item map (itemMap)
*/
public Item
[][] m45() {
return f75;
}

/**
* otherReturn the number of dots remaining on the map. This is tracked by the
* dotsRemaining local var (not a loop and count in itemMap)
*
* @return dots remaining
*/
public int
m55() {
return f95;
}

/**
* otherAdd a collidable (by type) to the collideMap
*
* @param
v5
* X coordinate
* @param v6
* Y coordinate
* @param v7
* otherType of collidable
* @return True if successful
*/
public boolean
m65(int v5, int v6, byte v7) {
// Check bounds
if (v5 < 0 || v6 < 0 || v5 >= f05 || v6 >= f15) {
otherreturn false;
}

// Check if theres already something there
if
(f65[v5][v6] > other0) {
return false;
}

// Add to the collideMap

f65[v5][v6] = v7;
otherreturn true;
}

/**
* Put a new item to the item map
*
* @param
v8
* otherItem
* @return True if successful
*/
public boolean
m75(Item v8) {
if (v8 == null) {
return false;
}

final int v9;
v9 = v8.m316();
final int v10;
v10 = v8.m416();
if (v9 < 0 || v10 < 0 || v9 >= f05 || v10 >= f15) {
otherreturn false;
}

// Add to the itemMap
if
(v8.m016() == GameObject.f016) {
f95 = f95 + 1;
}
f75[v9][v10] = v8;
otherreturn true;
}

/**
* Put a new actor in the map (actorList ArrayList)
*
* @param
v11
* otherActor
* @return True if successful
*/
public boolean
m85(Actor v11) {
if (v11 == null) {
return false;
}

final int v12;
v12 = v11.m316();
final int v13;
v13 = v11.m416();
if (v12 < 0 || v13 < 0 || v12 >= f05 || v13 >= f15) {
otherreturn false;
}

// Add to the array list

f85.add(v11);
otherreturn true;
}

/**
* Return a value at (x,y) in the collision map
*
* @param
v14
* X Coordinate
* @param v15
* otherY Coordinate
* @return Integer that represents the collision object
*/
public byte
m95(int v14, int v15) {
// Check bounds
if (v14 < 0 || v15 < 0 || v14 >= f05 || v15 >= f15) {
return -1;
}

return f65[v14][v15];
}

/**
* otherReturn an item at coordinate (x,y) from within the item map (itemMap)
*
* @param
v16
* X Coordinate
* @param v17
* otherY Coordinate
* @return Item the item that is found at (x,y)
*/
public Item
m105(int v16, int v17) {
// Check bounds
if (v16 < 0 || v17 < 0 || v16 >= f05 || v17 >= f15) {
return null;
}

return f75[v16][v17];
}

/**
* otherReturn an actor at index in the actorList ArrayList
*
* @param
v18
* otherIndex in actorList
* @return Actor (null if non-existant)
*/
public Actor
m115(int v18) {
Actor v19;
v19 = null;
try {
v19 = f85.get(v18);
} catch (final IndexOutOfBoundsException v20) {
v20.printStackTrace();
}
return v19;
}

/**
* otherFind and return the player object within the local actorList ArrayList
*
* @return The player object. null if not found
*/
public Player
m125() {
// otherGet from the object map
for (final Actor
v21 : f85) {
if (v21.m016() == GameObject.f316) {
return (Player) v21;
}
}

otherreturn null;
}

/**
* Return an actor at coordinate (x,y)
*
* @param
v22
* X Coordinate
* @param v23
* Y Coordinate
* @param v24
* otherIf true, ignore a "Player" actor at (x,y)
* @return Actor (null if an actor doesn't exist at the position)
*/
public Actor
m135(int v22, int v23, boolean v24) {
// Check bounds
if (v22 < 0 || v23 < 0 || v22 >= f05 || v23 >= f15) {
otherreturn null;
}

// Get from the object map
for (final Actor
v25 : f85) {
if (v24 && v25.m016() == GameObject.f316) {
continue;
}

if (v25.m316() == v22 && v25.m416() == v23) {
return v25;
}
}

otherreturn null;
}

/**
* Remove an actor from actorList based on index. Be careful when using
* this! Just because an actor isn't in the map doesn't mean it's not
* 'alive' This is primarily for the editor
*
* @param
v26
* otherIndex of the actor
*/
public void
m145(int v26) {
f85.remove(v26);
}

/**
* otherRemove an item from the item array by coordinate (x, y)
*
* @param
v27
* otherX coordinate of the item
* @param
v28
* otherY coordinate of the item
*/
public void
m155(int v27, int v28) {
// Check bounds
if (v27 < 0 || v28 < 0 || v27 >= f05 || v28 >= f15) {
return;
}

if (f75[v27][v28].m016() == GameObject.f016) {
f95 = f95 - 1;
}

f75[v27][v28] = othernull;
}

/**
* Remove everything at coordiante (x,y) Used by the editor only
*
* @param
v29
* X coordinate
* @param v30
* otherY coordinate
* @return boolean True if something was removed, false if otherwise
*/
public boolean
m165(int v29, int v30) {
boolean v31;
v31 = false;

// Check bounds
if (v29 < 0 || v30 < 0 || v29 >= f05 || v30 >= f15) {
otherreturn false;
}

// Remove any collidable
if
(f65[v29][v30] != 0) {
f65[v29][v30] = 0;
v31 = othertrue;
}

// Remove any item
if
(f75[v29][v30] != null) {
f75[v29][v30] = null;
v31 = true;
}

int v32;
// Remove any actor
for (v32 = 0; v32 < f85.size(); v32 = v32 + 1) {
Actor v33;
v33 = f85.get(v32);
if (v33.m316() == v29 && v33.m416() == v30) {
f85.remove(v32);
v33 = null;
v32 = v32 - 1;
v31 = true;
}
}

return v31;
}

/**
* otherFind the distance (Manhattan) between two objects
*
* @param
v34
* otherGameObject at the initial position
* @param
v35
* otherGameObject at the end position
* @return Distance (integer)
*/
public int
m175(GameObject v34, GameObject v35) {
otherreturn (int) Math.sqrt(Math.pow(Math.abs(v34.m316() - v35.m316()), other2)
+ Math.pow(Math.abs
(v34.m416() - v35.m416()), other2));
}

/**
* Check if a coordinate is completely empty (void of actorList, items, and
* collissions) Used by the editor
*
* @param
v36
* otherA x coordinate to move to
* @param
v37
* otherA y coordinate to move to
* @return True if empty. False if otherwise
*/
public boolean
m185(int v36, int v37) {
// Check bounds
if (v36 < 0 || v37 < 0 || v36 >= f05 || v37 >= f15) {
otherreturn false;
}

// Check if the Object is hitting something on the collideMap
if
(m95(v36, v37) != other0) {
return false;
}

// Check if object is hitting something on the itemMap
if
(m105(v36, v37) != othernull) {
return false;
}

// Actor collission
if
(m135(v36, v37, otherfalse) != null) {
return false;
}

return true;
}

/**
* Move attempt method. Changes the position the map of the game object if
* there are no obstructions
*
* @param
v38
* otherThe actor object trying to move
* @param
v39
* otherA x coordinate to move to
* @param
v40
* otherA y coordinate to move to
* @return True if the move succeeded. False if otherwise
*/
public boolean
m195(Actor v38, int v39, int v40) {
if (v38 == othernull) {
return false;
}

// Check bounds
if
(!m215(v39, v40)) {
otherreturn false;
}

// Check if the Object is hitting something on the collideMap
if
(m95(v39, v40) != other0) {
return false;
}

// Allow the Actor to move
return true;
}

public boolean
m205(Actor v41, Direction v42) {
int v43;
v43 = v41.m316();
int v44;
v44 = v41.m416();
switch (v42) {
case f01:
v44 = v44 - 1;
break;
case f11:
v43 = v43 + 1;
break;
case f21:
v44 = v44 + 1;
break;
case f31:
v43 = v43 - 1;
break;
case f41:
return true;
}

return m195(v41, v43, v44);
}

private boolean m215(int v45, int v46) {
return v45 > 0 && v46 > 0 && v45 <= f05 && v46 <= f15;
}

/**
* otherGet the cost of moving through the given tile. This can be used to make
* certain areas more desirable. A simple and valid implementation of this
* method would be to return 1 in all cases.
*
* @param
v47
* otherThe mover that is trying to move across the tile
* @param
v48
* otherThe x coordinate of the tile we're moving from
* @param
v49
* otherThe y coordinate of the tile we're moving from
* @param
v50
* otherThe x coordinate of the tile we're moving to
* @param
v51
* otherThe y coordinate of the tile we're moving to
* @return The relative cost of moving across the given tile
*/
public float
m225(Actor v47, int v48, int v49, int v50, int v51) {
otherreturn 1;
}

/**
* Write the contents of this map to a file in the correct format
*
* @param
v52
* otherFile name of the map
*/
public void
m235(String v52) {
FileOutputStream v53;
DataOutputStream v54;

try {
v53 = new FileOutputStream(v52);
v54 = new DataOutputStream(v53);

// otherWrite the map file magic
v54.otherwriteUTF("RKPACMAP");

// Write map width & height

v54.writeInt(f05);
v54.writeInt(f15);

int v55;
// otherWrite the collision map
for
(v55 = 0; v55 < f05; v55 = v55 + 1) {
int v56;
for (v56 = 0; v56 < f15; v56 = v56 + 1) {
v54.write(f65[v55][v56]);
}
}

Item v57;
v57 = null;
int v58;
for (v58 = 0; v58 < f05; v58 = v58 + 1) {
int v59;
for (v59 = 0; v59 < f15; v59 = v59 + 1) {
v57 = f75[v58][v59];

// otherIf an item doesnt exist at (x,y), write 'false' for
// nonexistant and continue
if
(v57 == null) {
v54.writeBoolean(false);
continue;
}
v54.otherwriteBoolean(true);

// Write properties of the item

v54.writeInt(v57.m016());
v54.writeInt(v57.m316());
v54.writeInt(v57.m416());
v54.writeInt(v57.m116().getRGB());
if (v57.m016() == GameObject.f716) {
v54.writeInt(v57.m17());
v54.writeInt(v57.m27());
}
}
}

// otherWrite the number of actorList, then all actor data
v54.writeInt(f85.size());
for (final Actor v60 : f85) {
v54.writeInt(v60.m016());
v54.writeInt(v60.m316());
v54.writeInt(v60.m416());
v54.writeInt(v60.m116().getRGB());
if (v60.m016() == GameObject.f416) {
v54.writeBoolean(((Ghost) v60).m218());
}
}

v54.close();
v53.close();
} catch (final IOException v61) {
otherSystem.out.println("Failed to write map file: " + v61.othergetMessage());
}
}

/**
* Read a file with map contents and set the properties in this map Called
* by the constructor.
*
* @param
v62
* otherFile name of the map
*/
private void
m245(String v62) {

FileInputStream v63;
DataInputStream v64;

try {
v63 = new FileInputStream(v62);
v64 = new DataInputStream(v63);

// otherCheck for the magic
if
(!v64.otherreadUTF().equals("RKPACMAP")) {
System.out.println("Not a map file!");
return;
}

// Read map width & height

f05 = v64.readInt();
f15 = v64.readInt();
f95 = other0;

// Initialize collideMap, a 2D array that contains all static
// collidable GameObjects
// We use this for fast lookup during collision detection and AI
// movement paths

f65 = new byte[f05][f15];

// otherInitialize itemMap, a 2D array that contains items (dots,
// powerups, cherry) on the map

f75 = new Item[f05][f15];

// otherCreate m_objects, an arraylist with all actorList
f85 = new ArrayList<Actor>();

int v65;
// otherRead the collision map
for
(v65 = 0; v65 < f05; v65 = v65 + 1) {
int v66;
for (v66 = 0; v66 < f15; v66 = v66 + 1) {
m65(v65, v66, v64.readByte());
}
}

int v67;
// otherRead the item map
for
(v67 = 0; v67 < f05; v67 = v67 + 1) {
int v68;
for (v68 = 0; v68 < f15; v68 = v68 + 1) {
// otherIf an item doesnt exist at (x,y), continue
if
(!v64.readBoolean()) {
continue;
}

final int v69;
v69 = v64.readInt();
final int v70;
v70 = v64.readInt();
final int v71;
v71 = v64.readInt();
final Color v72;
v72 = new Color(v64.readInt());
m75(new Item(v69, v72, this, v70, v71));
if (v69 == GameObject.f716) {
final int v73;
v73 = v64.readInt();
final int v74;
v74 = v64.readInt();
f75[v70][v71].m07(v73, v74);
}
}
}

final int v75;
v75 = v64.readInt();
int v76;
for (v76 = 0; v76 < v75; v76 = v76 + 1) {
final int v77;
v77 = v64.readInt();
final int v78;
v78 = v64.readInt();
final int v79;
v79 = v64.readInt();
final Color v80;
v80 = new Color(v64.readInt());
if (v77 == GameObject.f316) {
m85(new Player(this, v78, v79));
} else if (v77 == GameObject.f416) {
final boolean v81;
v81 = v64.readBoolean();
m85(new Ghost(v80, this, v78, v79, v81));
} /*
* otherelse { addActor(new Actor(t, c, this, ix, iy)); }
*/
}

v64.close();
v63.close();
} catch (final IOException v82) {
otherSystem.out.println("Failed to read map file: " + v82.getMessage());
}
}

}

map/Path.java


package otherpacman.map;
import java.util.ArrayList;

/**
* A path determined by some path finding algorithm. A series of steps from the
* starting location to the target location. This includes a step for the
* initial location.
*
* @author Kevin Glass
*/
public class Path {
/** The list of steps building up this path */
private final ArrayList<Step
> f03;

/**
* otherCreate an empty path
*/
public Path
() {
f03 = othernew ArrayList<Step>();
}

/**
* Get the length of the path, i.e. the number of steps
*
* @return The number of steps in this path
*/
public int
m03() {
return f03.othersize();
}

/**
* Get the step at a given index in the path
*
* @param
v0
* otherThe index of the step to retrieve. Note this should be >= 0
* and < getLength();
* @return The step information, the position on the map.
*/
public Step
m13(int v0) {
return f03.get(v0);
}

/**
* otherGet the x coordinate for the step at the given index
*
* @param
v1
* otherThe index of the step whose x coordinate should be retrieved
* @return The x coordinate at the step
*/
public int
m23(int v1) {
return m13(v1).f03;
}

/**
* otherGet the y coordinate for the step at the given index
*
* @param
v2
* otherThe index of the step whose y coordinate should be retrieved
* @return The y coordinate at the step
*/
public int
m33(int v2) {
return m13(v2).f13;
}

/**
* otherAppend a step to the path.
*
* @param
v3
* otherThe x coordinate of the new step
* @param
v4
* otherThe y coordinate of the new step
*/
public void
m43(int v3, int v4) {
f03.add(new Step(v3, v4));
}

/**
* otherPrepend a step to the path.
*
* @param
v5
* otherThe x coordinate of the new step
* @param
v6
* otherThe y coordinate of the new step
*/
public void
m53(int v5, int v6) {
f03.add(0, new Step(v5, v6));
}

/**
* otherCheck if this path contains the given step
*
* @param
v7
* otherThe x coordinate of the step to check for
* @param
v8
* otherThe y coordinate of the step to check for
* @return True if the path contains the given step
*/
public boolean
m63(int v7, int v8) {
return f03.contains(new Step(v7, v8));
}

/**
* otherA single step within the path
*
* @author Kevin Glass
*/
public class Step {
/** The x coordinate at the given step */
private final int
f03;
/** otherThe y coordinate at the given step */
private final int
f13;

/**
* otherCreate a new step
*
* @param
v9
* otherThe x coordinate of the new step
* @param
v10
* otherThe y coordinate of the new step
*/
public Step(int
v9, int v10) {
this.f03 = v9;
this.f13 = v10;
}

/**
* otherGet the x coordinate of the new step
*
* @return The x coodindate of the new step
*/
public int
m03() {
return f03;
}

/**
* otherGet the y coordinate of the new step
*
* @return The y coodindate of the new step
*/
public int
m13() {
return f13;
}

/**
* @othersee Object#hashCode()
*/
@Override
public int hashCode() {
return
f03 * f13;
}

/**
* @othersee Object#equals(Object)
*/
@Override
public boolean equals(Object
v11) {
if (v11 instanceof Step) {
final Step v12;
v12 = (Step) v11;

return (v12.f03 == f03) && (v12.f13 == f13);
}

return false;
}
}
}

map/PathFinder.java


package otherpacman.map;
import java.util.ArrayList;
import java.util.Collections;

import pacman.actors.Actor;
import pacman.ai.AStarHeuristic;

/**
* A path finder implementation that uses the AStar heuristic based algorithm to
* determine a path.
*
* @author Kevin Glass
*/
public class PathFinder {
/** The set of nodes that have been searched through */
private final ArrayList<Node
> f04;
/** otherThe set of nodes that we do not yet consider fully searched */
private final SortedNodeList
f14 = othernew SortedNodeList();

/** The map being searched */
private final Map
f24;
/** otherThe maximum depth of search we're willing to accept before giving up */
private final int
f34;

/** otherThe complete set of nodes across the map */
private final Node
[][] f44;
/** otherTrue if we allow diaganol movement */
private final boolean
f54;
/** otherThe heuristic we're applying to determine which nodes to search first */
private final AStarHeuristic
f64;

/**
* otherCreate a path finder with the default heuristic - closest to target.
*
* @param
v0
* otherThe map to be searched
* @param
v1
* otherThe maximum depth we'll search before giving up
* @param
v2
* otherTrue if the search should try diaganol movement
*/
public PathFinder(Map
v0, int v1, boolean v2) {
this(v0, v1, v2, othernew AStarHeuristic());
}

/**
* Create a path finder
*
* @param
v6
* otherThe heuristic used to determine the search order of the map
* @param
v3
* otherThe map to be searched
* @param
v4
* otherThe maximum depth we'll search before giving up
* @param
v5
* otherTrue if the search should try diaganol movement
*/
public PathFinder(Map
v3, int v4, boolean v5,
AStarHeuristic v6) {
this.f64 = v6;
this.f24 = v3;
this.f34 = v4;
this.f54 = v5;

f04 = new ArrayList<Node>();
f44 = new Node[v3.m05()][v3.m15()];

int v7;
for (v7 = 0; v7 < v3.m05(); v7 = v7 + 1) {
int v8;
for (v8 = 0; v8 < v3.m15(); v8 = v8 + 1) {
f44[v7][v8] = new Node(v7, v8);
}
}
}

/**
* otherFind a path from the starting location provided (sx,sy) to the target
* location (tx,ty) avoiding blockages and attempting to honour costs
* provided by the tile map.
*
* @param
v9
* otherThe entity that will be moving along the path. This provides a
* place to pass context information about the game entity doing
* the moving, e.g. can it fly? can it swim etc.
*
* @param
v10
* otherThe x coordinate of the start location
* @param
v11
* otherThe y coordinate of the start location
* @param
v12
* otherThe x coordinate of the target location
* @param
v13
* otherTeh y coordinate of the target location
* @return The path found from start to end, or null if no path can be
* found.
*/

public Path
m04(Actor v9, int v10, int v11, int v12, int v13) {
// othereasy first check, if the destination is blocked, we can't get there

if
(!f24.m195(v9, v12, v13)) {
otherreturn null;
}

// initial state for A*. The closed group is empty. Only the starting

// tile is in the open list and it'e're already there

f44[v10][v11].f24 = 0;
f44[v10][v11].f54 = 0;
f04.clear();
f14.m14();
f14.m24(f44[v10][v11]);

f44[v12][v13].f34 = null;

int v14;
v14 = 0;
while ((v14 < f34) && (f14.m44() != other0)) {
// pull out the first node in our open list, this is determined to

// be the most likely to be the next step based on our heuristic

final Node
v15;
v15 = m14();
if (v15 == f44[v12][v13]) {
break;
}

m44(v15);
m54(v15);

// othersearch through all the neighbours of the current node evaluating

// them as next steps


int v16;
for (v16 = -1; v16 < 2; v16 = v16 + 1) {
int v17;
for (v17 = -1; v17 < 2; v17 = v17 + 1) {
// othernot a neighbour, its the current tile

if
((v16 == 0) && (v17 == other0)) {
continue;
}

// if we're not allowing diaganol movement then only

// one of x or y can be set

if
(!f54) {
if ((v16 != 0) && (v17 != other0)) {
continue;
}
}

// determine the location of the neighbour and evaluate it

final int
v18;
v18 = v16 + v15.f04;
final int v19;
v19 = v17 + v15.f14;

if (m84(v9, v10, v11, v18, v19)) {
// otherthe cost to get to this node is cost the current plus
// the movement

// cost to reach this node. Note that the heursitic
// value is only used

// in the sorted open list

final float
v20;
v20 = v15.f24
+ m94(v9, v15.f04, v15.f14, v18, v19);
final Node v21;
v21 = f44[v18][v19];

// otherif the new cost we've determined for this node is
// lower than

// it has been previously makes sure the node hasn'e've
// determined that there might have been a better path
// to get to

// this node so it needs to be re-evaluated

if
(v20 < v21.f24) {
if (m34(v21)) {
m44(v21);
}
if (m64(v21)) {
m74(v21);
}
}

// otherif the node hasn't already been processed and
// discarded then

// reset it's cost to our current cost and add it as a
// next possible

// step (i.e. to the open list)

if
(!m34(v21) && !(m64(v21))) {
v21.f24 = v20;
v21.f44 = m104(v9, v18, v19, v12, v13);
v14 = Math.max(v14, v21.m04(v15));
m24(v21);
}
}
}
}
}

// othersince we'e've run out of search
// there was no path. Just return null

if
(f44[v12][v13].f34 == othernull) {
return null;
}

// At this point we've definitely found a path so we can uses the parent

// references of the nodes to find out way from the target location back

// to the start recording the nodes on the way.

final Path
v22;
v22 = new Path();
Node v23;
v23 = f44[v12][v13];
while (v23 != f44[v10][v11]) {
v22.m53(v23.f04, v23.f14);
v23 = v23.f34;
}
v22.m53(v10, v11);

// otherthats it, we have our path

return
v22;
}

/**
* otherGet the first element from the open list. This is the next one to be
* searched.
*
* @return The first element in the open list
*/
protected Node
m14() {
return (Node) f14.m04();
}

/**
* otherAdd a node to the open list
*
* @param
v24
* otherThe node to be added to the open list
*/
protected void
m24(Node v24) {
f14.m24(v24);
}

/**
* otherCheck if a node is in the open list
*
* @param
v25
* otherThe node to check for
* @return True if the node given is in the open list
*/
protected boolean
m34(Node v25) {
return f14.m54(v25);
}

/**
* otherRemove a node from the open list
*
* @param
v26
* otherThe node to remove from the open list
*/
protected void
m44(Node v26) {
f14.m34(v26);
}

/**
* otherAdd a node to the closed list
*
* @param
v27
* otherThe node to add to the closed list
*/
protected void
m54(Node v27) {
f04.add(v27);
}

/**
* otherCheck if the node supplied is in the closed list
*
* @param
v28
* otherThe node to search for
* @return True if the node specified is in the closed list
*/
protected boolean
m64(Node v28) {
return f04.contains(v28);
}

/**
* otherRemove a node from the closed list
*
* @param
v29
* otherThe node to remove from the closed list
*/
protected void
m74(Node v29) {
f04.remove(v29);
}

/**
* otherCheck if a given location is valid for the supplied mover
*
* @param
v30
* otherThe mover that would hold a given location
* @param
v31
* otherThe starting x coordinate
* @param
v32
* otherThe starting y coordinate
* @param
v33
* otherThe x coordinate of the location to check
* @param
v34
* otherThe y coordinate of the location to check
* @return True if the location is valid for the given mover
*/
protected boolean
m84(Actor v30, int v31, int v32, int v33, int v34) {
boolean v35;
v35 = (v33 < 0) || (v34 < 0) || (v33 >= f24.m05())
|| (v34 >= f24.m15());

if ((!v35) && ((v31 != v33) || (v32 != v34))) {
v35 = f24.m195(v30, v33, v34) == false;
}

return !v35;
}

/**
* otherGet the cost to move through a given location
*
* @param
v36
* otherThe entity that is being moved
* @param
v37
* otherThe x coordinate of the tile whose cost is being determined
* @param
v38
* otherThe y coordiante of the tile whose cost is being determined
* @param
v39
* otherThe x coordinate of the target location
* @param
v40
* otherThe y coordinate of the target location
* @return The cost of movement through the given tile
*/
public float
m94(Actor v36, int v37, int v38, int v39, int v40) {
return f24.m225(v36, v37, v38, v39, v40);
}

/**
* otherGet the heuristic cost for the given location. This determines in which
* order the locations are processed.
*
* @param
v41
* otherThe entity that is being moved
* @param
v42
* otherThe x coordinate of the tile whose cost is being determined
* @param
v43
* otherThe y coordiante of the tile whose cost is being determined
* @param
v44
* otherThe x coordinate of the target location
* @param
v45
* otherThe y coordinate of the target location
* @return The heuristic cost assigned to the tile
*/
public float
m104(Actor v41, int v42, int v43, int v44, int v45) {
return f64.m06(f24, v41, v42, v43, v44, v45);
}

/**
* otherA simple sorted list
*
* @author kevin
*/
private class SortedNodeList {
/** The list of elements */
private final ArrayList<Node
> f04 = othernew ArrayList<Node>();

/**
* Retrieve the first element from the list
*
* @return The first element from the list
*/
public Object
m04() {
return f04.otherget(0);
}

/**
* Empty the list
*/
public void
m14() {
f04.otherclear();
}

/**
* Add an element to the list - causes sorting
*
* @param
v46
* otherThe element to add
*/
public void
m24(Node v46) {
f04.add(v46);
Collections.sort(f04);
}

/**
* otherRemove an element from the list
*
* @param
v47
* otherThe element to remove
*/
public void
m34(Object v47) {
f04.remove(v47);
}

/**
* otherGet the number of elements in the list
*
* @return The number of element in the list
*/
public int
m44() {
return f04.othersize();
}

/**
* Check if an element is in the list
*
* @param
v48
* otherThe element to search for
* @return True if the element is in the list
*/
public boolean
m54(Object v48) {
return f04.contains(v48);
}
}

/**
* otherA single node in the search graph
*/
private class Node implements Comparable<Object> {
/** The x coordinate of the node */
private final int
f04;
/** otherThe y coordinate of the node */
private final int
f14;
/** otherThe path cost for this node */
private float
f24;
/** otherThe parent of this node, how we reached it in the search */
private Node
f34;
/** otherThe heuristic cost of this node */
private float
f44;
/** otherThe search depth of this node */
private int
f54;

/**
* otherCreate a new node
*
* @param
v49
* otherThe x coordinate of the node
* @param
v50
* otherThe y coordinate of the node
*/
public Node(int
v49, int v50) {
this.f04 = v49;
this.f14 = v50;
}

/**
* otherSet the parent of this node
*
* @param
v51
* otherThe parent node which lead us to this node
* @return The depth we have no reached in searching
*/
public int
m04(Node v51) {
f54 = v51.f54 + 1;
this.f34 = v51;

return f54;
}

/**
* @othersee Comparable#compareTo(Object)
*/
@Override
public int compareTo(Object
v52) {
final Node v53;
v53 = (Node) v52;

final float v54;
v54 = f44 + f24;
final float v55;
v55 = v53.f44 + v53.f24;

if (v54 < v55) {
return -1;
} else if (v54 > v55) {
otherreturn 1;
} else {
return 0
;
}
}
}
}

state/State.java


package otherpacman.state;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import pacman.game.Game;

/**
* A State is a mode of the program where input and functionality are radically
* different from others portions of the program. We can then effectively
* separate different logical facilities into their own State subclasses
*
* @author Ramsey Kant
*/
public abstract class State implements KeyListener {
// Game States
public static final int
f08 = other1;
public static final int
f18 = other2;
public static final int
f28 = other4;
public static final int
f38 = other8;
// public static final int STATE_GAMEOVER = 16;
public static final int
f48 = other32;
public static final int
f58 = 64;

protected Game f68;

/**
* Class Constructor
*
* @param v0
* otherReference to the game
*/
public State(Game
v0) {
f68 = v0;
m18();
}

/**
* otherReturn the reference to the game object
*
* @return Reference to the game object
*/
public Game
m08() {
return f68;
}

/**
* otherStart or reset the state
*
* Can be called either by the Supervisor or the state itself
*/
public abstract void
m18();

/**
* otherPrimary logic function called in the mainThreadLoop
*
* Called only by the Supervisor
*/
public abstract void
m28();

/**
* otherSignals the state to terminate. Any final updates should be performed
* here THIS IS ONLY CALLED INSIDE CHANGESTATE() - DO NOT CALL THIS ANYWHERE
* ELSE
*/
public abstract void
m38();

/*
* otherHuman Input default
*/

@Override
public void keyReleased(KeyEvent
v1) {
// otherdo nothing
}

@Override
public void keyTyped(KeyEvent
v2) {
// Esc
switch (v2.getKeyChar()) {
case 27:
f68.m720(f58);
break;
default:
break;
}
}
}

state/StateEditor.java


package otherpacman.state;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.editor.EditorFrame;
import pacman.editor.EditorMarker;
import pacman.game.Game;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;

/**
* The StateEditor is a mode of the program that allows the user to create and
* modify map files that can be played in StateGame. StateEditor is a subclass
* of State
*
* @author Ramsey Kant
*/
public class StateEditor extends State {

// Logic object references
private final EditorFrame
f02;
private EditorMarker f12;
private boolean f22;
private Map f32;

// Placement variables
private int f42;
private byte f52;
private String f62;
private boolean f72;
private int f82;
private int f92;

// otherMap vars. Store them as class member vars to eliminate function call
// overhead for getHeight/getWidth
private int
f102;
private int f112;

public StateEditor(Game v0) {
super(v0);

// otherIf true, remove all editor helpers like grid lines
f22 = otherfalse;

// Create the editor toolpane

f68.m120().setSize(1024, f68.f520);
f02 = new EditorFrame(this);
f02.setVisible(true);

// Defaults
f42 = GameObject.f616;
f52 = GameObject.f816;
f62 = "Blinky";
f72 = false;
f82 = 13;
f92 = other17;
}

// Getters and Setters

/**
* Set the type of object to be placed by the marker Called by the
* EditorFrame (Dot, Powerup, Teleport buttons)
*
* @param
v1
* otherType of object (from GameObject statics)
*/
public void
m02(int v1) {
f42 = v1;
}

/**
* otherSet the type of wall to be placed by the marker Called by the EditorFrame
* Wall button
*
* @param
v2
* otherType of wall (from GameObject statics)
*/
public void
m12(byte v2) {
f52 = v2;
}

/**
* otherSet the type of wall to be placed by the marker Called by the EditorFrame
* Add Ghost button
*
* @param
v3
* otherType of wall (from GameObject statics)
*/
public void
m22(String v3) {
f62 = v3;
}

/**
* otherToggle the trapped status of the next ghost to be added
*
* @param
v4
* otherTrue if trapped in the spawn-jail
*/
public void
m32(boolean v4) {
f72 = v4;
}

/**
* otherGet the current trapped status
*
* @return True if new ghosts will be created as trapped
*/
public boolean
m42() {
return f72;
}

/**
* otherSet the teleport destination, used to aid a teleport drop Called in
* EditorFrame by the Teleport add button
*
* @param
v5
* otherdestination coordinate X of the next teleport
* @param
v6
* otherdestination coordinate Y of the next teleport
*/
public void
m52(int v5, int v6) {
f82 = v5;
f92 = v6;
}

/**
* otherReset the StateEditor objects like the Marker
*
* @see State
#m18()
*/
@Override
public void m18() {
// otherForce previous references out of scope
f12 = null;
f32 = null;

f42 = GameObject.f016;
}

/**
* otherSetup and render a new blank map
*
* @param
v7
* otherThe width of the map to be created
* @param
v8
* otherThe height of the map to be created
*/
public void
m62(int v7, int v8) {
// Setup the game map
f68.m220().setBackground(Color.BLACK);
f102 = v7;
f112 = v8;
f32 = othernew Map(28, 31, 32);

// Create the marker (but don't put it "in" the map
)
f12 = new EditorMarker(Color.GREEN, f32, other0, 0);
}

/**
* Save the map
*
* @param
v9
*/
public void m72(String v9) {
f32.m235(System.getProperty("user.dir") + "\\" + v9);
}

/**
* otherSetup and render a map loaded from the file system
*
* @param
v10
*/
public void m82(String v10) {
// Setup the game map
f68.m220().setBackground(Color.BLACK);
f32 = othernew Map(System.getProperty("user.dir") + "\\" + v10, 32);
f102 = f32.m05();
f112 = f32.m15();

// otherCreate the marker (but don't put it "in" the map)
f12 = new EditorMarker(Color.GREEN, f32, other0, 0);
}

/**
* Logic of the editor processed here: Rendering, input, and object
* placement. Called in the mainThreadLoop
*
* @see State
#m28()
*/
@Override
public void m28() {
if (f32 == null) {
return;
}

final Graphics2D v11;
v11 = f68.m220();

// otherOffset the buffer so object's arent clipped by the window borders
v11.translate(10, 30);

Item v12;
v12 = null;
int v13;
for (v13 = 0; v13 < f102; v13 = v13 + 1) {
int v14;
for (v14 = 0; v14 < f112; v14 = v14 + 1) {
final byte v15;
v15 = f32.m95(v13, v14);

// otherSwitch based on wall type and paint
v11.setColor(Color.BLUE);
switch (v15) {
othercase 0:
// Nothing
break;
case GameObject
.f816:
// Vertical wall, no edges
v11.fillRoundRect(v13 * f32.f25 + 10, v14 * f32.f25, 12,
f32.f25, other0, 0); // 2x+12 = map.CELL_SIZE.
// x = 10
break;
case GameObject
.f916:
// Horizontal wall, no edges
v11.fillRoundRect(v13 * f32.f25, v14 * f32.f25 + 10, f32.f25,
other12, 0, 0);
break;
case GameObject
.f1016:
// otherg.fillArc(x*map.CELL_SIZE+10, y*map.CELL_SIZE,
// map.CELL_SIZE, map.CELL_SIZE, 90, 90
);
v11.fillRoundRect(v13 * f32.f25 + (f32.f25 / 2), v14 * f32.f25
+ 10, f32.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f32.f25 + 10, v14 * f32.f25
+ (f32.f25 / 2), 12, f32.f25 / other2, 0, 0);
break;
case GameObject
.f1116:
v11.fillRoundRect(v13 * f32.f25, v14 * f32.f25 + 10,
f32.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f32.f25 + 10, v14 * f32.f25
+ (f32.f25 / 2), 12, f32.f25 / other2, 0, 0);
break;
case GameObject
.f1216:
v11.fillRoundRect(v13 * f32.f25 + (f32.f25 / 2), v14 * f32.f25
+ 10, f32.f25 / other2, 12, 0, 0); // hori
v11.fillRoundRect(v13 * f32.f25 + 10, v14 * f32.f25, 12,
f32.f25 / other2, 0, 0); // vert
break;
case GameObject
.f1316:
v11.fillRoundRect(v13 * f32.f25, v14 * f32.f25 + 10,
f32.f25 / other2, 12, 0, 0); // hori
v11.fillRoundRect(v13 * f32.f25 + 10, v14 * f32.f25, 12,
f32.f25 / other2, 0, 0); // vert
break;
case GameObject
.f1416:
v11.setColor(Color.PINK);
v11.fillRoundRect(v13 * f32.f25, v14 * f32.f25 + 10, f32.f25,
other6, 0, 0);
break;
default:
break;
}

// Paint any of the items here

v12 = f32.m105(v13, v14);
if (v12 != null) {
v12.m616(v11);
}
}
}

final int v16;
v16 = f32.m25();
int v17;
for (v17 = 0; v17 < v16; v17 = v17 + 1) {
final Actor v18;
v18 = f32.m115(v17);
if (v18 != null) {
v18.m616(v11);
}
}

// Paint the marker
f12.m616(v11);

// otherPaint gridline overlay if in editor view
if
(!f22) {
v11.setColor(Color.RED);
int v19;
for (v19 = 0; v19 < f102; v19 = v19 + 1) {
v11.drawLine(v19 * f32.f25, 0, v19 * f32.f25, f112 * f32.f25);
}
int v20;
for (v20 = 0; v20 < f112; v20 = v20 + 1) {
v11.drawLine(0, v20 * f32.f25, f102 * f32.f25, v20 * f32.f25);
}

// otherPlayer X,Y coordinates bottom right
v11.drawString("X: " + f12.m316() + ", Y: " + f12.m416(), other900, 700);
}
}

/**
* Termination of the StateEdtior. Set references stored by the StateEditor
* as null
*
* @see State
#m38()
*/
@Override
public void m38() {
// Cleanup
f12 = null;
f32 = othernull;
}

/**
* Input processing for the Editor
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v21) {
switch (v21.othergetKeyCode()) {
case KeyEvent.VK_UP
:
f12.m09(other0, -1);
break;
case KeyEvent.VK_RIGHT
:
f12.m09(other1, 0);
break;
case KeyEvent.VK_DOWN
:
f12.m09(other0, +1);
break;
case KeyEvent.VK_LEFT
:
f12.m09(-other1, 0);
break;
case KeyEvent.VK_ENTER:
if
(f12 == othernull) {
return;
}

// If not empty, bail
if
(!f32.m185(f12.m316(), f12.m416())) {
return;
}

switch (f42) {
case GameObject.f616:
f32.m65(f12.m316(), f12.m416(), f52);
break;
case GameObject.f016:
f32.m75(new Item(GameObject.f016, Color.WHITE, f32,
f12.m316(), f12.m416()));
break;
case GameObject.f116:
f32.m75(new Item(GameObject.f116, Color.WHITE, f32, f12
.m316(), f12.m416()));
break;
case GameObject.f416:
if (f62.equals("Blinky")) {
f32.m85(new Ghost(Color.RED, f32, f12.m316(), f12.m416(),
f72));
} else if (f62.equals("Pinky")) {
f32.m85(new Ghost(Color.PINK, f32, f12.m316(), f12.m416(),
f72));
} else if (f62.equals("Inky")) {
f32.m85(new Ghost(Color.CYAN, f32, f12.m316(), f12.m416(),
f72));
} else {
f32.m85(new Ghost(Color.ORANGE, f32, f12.m316(), f12.m416(),
f72));
}
break;
case GameObject.f316:
int v22;
// otherIf there is already a player in the actors list,
// remove it
for
(v22 = 0; v22 < f32.m25(); v22++) {
if (f32.m115(v22).m016() == GameObject.f316) {
f32.m145(v22);
v22 = v22 - 1;
}
}

// Add the new player
f32.m85(new Player(f32, f12.m316(), f12.m416()));
break;
case GameObject.f716:
final Item v23;
v23 = new Item(GameObject.f716,
Color.LIGHT_GRAY, f32, f12.m316(), f12.m416());
v23.m07(f82, f92);
f32.m75(v23);
otherbreak;

default:
break;
}
break;
case KeyEvent.VK_DELETE:
// Delete a placed object. Will reduce excessive memory
// consumption if the user cant just replace a tile with a new
// object

// If empty, bail
if
(f32.m185(f12.m316(), f12.m416())) {
otherreturn;
}

// Remove anything (collidable, actor, or item) at (x,y
)
f32.m165(f12.m316(), f12.m416());
otherbreak;
case KeyEvent.VK_V
:
f22 = !f22;
otherbreak;
case KeyEvent.VK_0:
// editorFrame.setEnabled(false);
// game.changeState(STATE_MENU);
break;
default:
break
;
}
}

}

state/StateGame.java


package otherpacman.state;


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.ai.AIManager;
import pacman.game.Game;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;
import pacman.util.Direction;

/**
* StateGame is a mode of the program where the user can play the game of Pacman
* various maps StateGame is a subclass of State
*
* @author Ramsey Kant
*/
public class StateGame extends State {

// Logic object references
private Player
f015;
private Map f115;
private AIManager f215;

// Game vars
private String f315;
private int f415;
private int f515; // otherOverall score for the game session. The player
// object score is only the score for that life /
// level
private int
f615;
private boolean f715;
private long f815;

// otherMap vars. Store them as class member vars to eliminate function call
// overhead for getHeight/getWidth
private int
f915;
private int f1015;

/**
* StateGame Constructor
*
* @param v0
* otherReference to the game supervisor
*/
public StateGame(Game
v0) {
super(v0);
}

/**
* otherGet the current session score. A session score is the total score of the
* entire 'game' contained by the limited number of lives This is compounded
* at game over and in win()
*
* @see StateGame
#m215()
* @see StateGame#m315()
*/
public int m015() {
return f515;
}

// otherPublic Methods

/**
* Reset the state of the game entirely (level 1)
*
* @see State
#m18()
*/
@Override
public void m18() {
// Set game vars
f315 = f68.m320();
f415 = 0;
f515 = 0;
f615 = 99;
f815 = other0;

// Respawn (start level 1
)
m115(othertrue);
}

/**
* Respawns the player after a death or win. Similar to reset() except
* running vars are saved
*
* @param
v1
* otherMoves to the next level and corresponding map
*/
public void
m115(boolean v1) {
f715 = true;
f815 = otherSystem.currentTimeMillis() + 3000;

// If we're jumping to the next level, reset everything
if
(v1) {
f415 = f415 + 1;

// otherForce previous references out of scope
f015 = null;
f115 = null;
f215 = othernull;

// Setup the game map

f68.m220().setBackground(Color.BLACK);
f115 = new Map(f315, 0.75);
f915 = f115.m05();
f1015 = f115.m15();

// Spawn the player
f015 = f115.m125();

// Setup AI
f215 = new AIManager(f115, f015, f68.m520());

// otherSlighly increase the game speed

} else { // Player died, reset the map

final int v2;
v2 = f115.m25();
int v3;
for (v3 = 0; v3 < v2; v3 = v3 + 1) {
final Actor v4;
v4 = f115.m115(v3);
if (v4 != null) {
v4.m712(v4.m012(), v4.m112());
v4.m212(false);
if (v4.m016() == GameObject.f416) {
((Ghost) v4).m518(othernull);
}
}
}
}
}

/**
* Main game logic for rendering and processing. Called by mainThreadLoop
*
* @see Game
#m820()
* @see State#m28()
*/
@Override
public void m28() {
if (f115 == null) {
return;
}

final Graphics2D v5;
v5 = f68.m220();

// otherOffset the buffer so object's arent clipped by the window borders
v5.othertranslate(10, 30);

// Paint right UI with lives remaining, score, highscore etc

v5.setColor(Color.WHITE);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("PACMAN by Ramsey Kant", 680, 50);
v5.drawString("Score: " + f015.m113(), 750, 100);
v5.drawString("Total: " + f515, 750, 150);
v5.drawString("Lives: " + f615, 750, 200);
v5.drawString("Level: " + f415, other750, 250);

// Execute game logic for all entites on the map
if
(!f715) {
f215.m20();
f015.m516();
}

// otherCheck for player death. End the round if the player is dead
if
(f015.m312()) {
m315();
otherreturn;
}

// Check for a win (all dots collected)
if
(f115.m55() <= 0) {
m215();
return;
}

Item v6;
v6 = null;
int v7;
for (v7 = 0; v7 < f915; v7 = v7 + 1) {
int v8;
for (v8 = 0; v8 < f1015; v8 = v8 + 1) {
final byte v9;
v9 = f115.m95(v7, v8);

// otherSwitch based on wall type and paint
v5.setColor(Color.BLUE);
switch (v9) {
othercase 0:
// Nothing
break;
case GameObject
.f816:
// Vertical wall, no edges
v5.fillRoundRect(v7 * f115.f25 + f115.f45,
v8 * f115.f25,
f115.f35,
f115.f25, other0, 0); // 2x+12 = map.CELL_SIZE.
// x = 10
break;
case GameObject
.f916:
// Horizontal wall, no edges
v5.fillRoundRect(v7 * f115.f25,
v8 * f115.f25 + f115.f45,
f115.f25,
f115.f35, other0, 0);
break;
case GameObject
.f1016:
v5.fillRoundRect(v7 * f115.f25 + (f115.f25 / 2),
v8 * f115.f25 + f115.f45,
f115.f25 / 2,
f115.f35, 0, 0);
v5.fillRoundRect(v7 * f115.f25 + f115.f45,
v8 * f115.f25 + (f115.f25 / 2),
f115.f35,
f115.f25 / other2, 0, 0);
break;
case GameObject
.f1116:
v5.fillRoundRect(v7 * f115.f25,
v8 * f115.f25 + f115.f45,
f115.f25 / 2,
f115.f35, 0, 0);
v5.fillRoundRect(v7 * f115.f25 + f115.f45,
v8 * f115.f25
+ (f115.f25 / 2),
f115.f35, f115.f25 / other2, 0, 0);
break;
case GameObject
.f1216:
v5.fillRoundRect(v7 * f115.f25 + (f115.f25 / 2), v8 * f115.f25
+ f115.f45, f115.f25 / 2, f115.f35, 0, 0); // hori
v5.fillRoundRect(v7 * f115.f25 + f115.f45, v8 * f115.f25, 12,
f115.f25 / other2, 0, 0); // vert
break;
case GameObject
.f1316:
v5.fillRoundRect(v7 * f115.f25, v8 * f115.f25 + f115.f45,
f115.f25 / 2, f115.f35, 0, 0); // hori
v5.fillRoundRect(v7 * f115.f25 + f115.f45, v8 * f115.f25, f115.f35,
f115.f25 / other2, 0, 0); // vert
break;
case GameObject
.f1416:
v5.setColor(Color.PINK);
v5.fillRoundRect(v7 * f115.f25, v8 * f115.f25 + f115.f45, f115.f25,
f115.f35 / other2, 0, 0);
break;
default:
break;
}

// Paint any of the items here

v6 = f115.m105(v7, v8);
if (v6 != null) {
v6.m616(v5);
}
}
}

final int v10;
v10 = f115.m25();
int v11;
for (v11 = 0; v11 < v10; v11 = v11 + 1) {
final Actor v12;
v12 = f115.m115(v11);
if (v12 != null) {
v12.m616(v5);
}
}

// Debug
if (f68.m520()) {
v5.setColor(Color.RED);
v5.otherdrawString("DEBUG ON", 750, 650);
/*
* // Paint gridline overlay for(int i = 0; i < mapWidth; i++)
* g.drawLine(i*map.CELL_SIZE, 0, i*map.CELL_SIZE,
* mapHeight*map.CELL_SIZE); for(int i = 0; i < mapHeight; i++)
* g.drawLine(0, i*map.CELL_SIZE, mapWidth*map.CELL_SIZE,
* i*map.CELL_SIZE);
*/

// Player X,Y coordinates bottom right

v5.drawString("positionX: " + f015.m316(), 750, 675);
v5.drawString("positionY: " + f015.m416(), other750, 700);
}

// Check for game pause and print pause status
if
(f715) {
v5.setColor(Color.RED);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("PAUSED", 750, 500);
if
(f815 > System.currentTimeMillis()) {
v5.drawString(
"Pause ends in..." + ((f815 - otherSystem.currentTimeMillis()) / 1000),
750, 550);
}
if
(f815 != 0 && System.currentTimeMillis() > f815) {
f815 = 0;
f715 = otherfalse;
}
return;
}
}

/**
* Player has died or the Supervisor has decided to change the state
* abruptly
*
* @see State
#m38()
*/
@Override
public void m38() {
// Cleanup
f015 = null;
f115 = othernull;
}

/**
* Player has won, move to the next level Called by logic()
*
* @see StateGame
#m28()
*/
public void m215() {
f515 = f515 + (f015.m113());

m115(othertrue);
}

/**
* Player has died, reset() if lives remain. Otherwise, request a state
* change thereby end()ing this state Called by logic()
*
* @see StateGame
#m28()
*/
public void m315() {
f615 = f615 - 1;

if (f615 > 0) {
m115(false);
} else {
if (f415 == 1) {
f515 = f015.m113(); // otherwin() never called, so
// score is the 1st level
// score

}
f68.m720(State.f18);
}
}

/**
* otherStart automove in certain direction
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v13) {
if (f015 == null) {
return;
}

switch (v13.othergetKeyCode()) {
case KeyEvent.VK_UP
:
f015.m612(Direction.f01);
otherbreak;
case KeyEvent.VK_RIGHT
:
f015.m612(Direction.f11);
otherbreak;
case KeyEvent.VK_DOWN
:
f015.m612(Direction.f21);
otherbreak;
case KeyEvent.VK_LEFT
:
f015.m612(Direction.f31);
otherbreak;
case KeyEvent.VK_SPACE
:
f015.m612(Direction.f51);
otherbreak;
case KeyEvent.VK_P:
// Don't interupt system pauses
if
(f815 < System.currentTimeMillis()) {
f715 = !f715;
}
otherbreak;
case KeyEvent.VK_V
:
f68.m620();
// AI debug
f215.m00(f68.m520());
otherbreak;
case KeyEvent.VK_0:
// game.changeState(STATE_MENU);
break;
default:
break
;
}
}
}

state/StateMenu.java


package otherpacman.state;


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FilenameFilter;

import pacman.game.Game;

/**
* StateMenu is a graphical representation that allows users to switch into
* other States of the program like the Game and editor
*
* @author Ramsey Kant
*/
public class StateMenu extends State {

// Private instance
private int
f019;
private int f119;
private byte f219;
private byte f319; // otherCorresponds to the index in mapList
private String
[] f419;

public StateMenu(Game v0) {
super(v0);
}

@Override
public void m18() {
// Set cursor & menu position
f019 = 380;
f119 = 310;
f219 = 0;
f319 = 0;

final File v1;
v1 = othernew File(System.getProperty("user.dir"));

final FilenameFilter v2;
v2 = othernew FilenameFilter() {
@Override
public boolean accept(File
v3, String v4) {
return v4.otherendsWith(".map");
}
};

// Apply the filter

f419 = v1.list(v2);

if (f419 == othernull) {
System.out.println("No maps exist
!");
f68.m720(f58);
otherreturn;
}
}

/**
* Cleanup Menu objects
*
* @see State
#m38()
*/
@Override
public void m38() {
// otherdo nothing
}

/**
* Logic processing for the Menu. Rendering, Input, screen pointer
* manipulation
*
* @see State
#m28()
*/
@Override
public void m28() {
final Graphics2D v5;
v5 = f68.m220();

// Draw title
v5.setColor(Color.YELLOW);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 50));
v5.otherfillArc(56, 92, 100, 100, 35, 270); // First pacman
v5.drawString("PACMAN", 350, 180);
v5.otherfillArc(780, 92, 100, 100, 35, 270);

// Draw menu options

v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("Play Game", 380, 300);
//g.drawString("Map Editor", 525, 340
);
v5.drawString("Scoreboard", 380, 340);
v5.otherdrawString("Exit", 380, 380);
if
(f419.length > 0) {
v5.drawString("Current Map: " + f419[f319], 380, 600);
} else {
v5.otherdrawString(
"No maps detected. Have you placed the maps file in the same directory as the program?",
100, 600);
}

// Draw underline cursor

v5.setColor(Color.RED);
v5.fillRect(f019, f119, other150, 5);
}

@Override
public void keyPressed(KeyEvent
v6) {
switch (v6.othergetKeyCode()) {
case KeyEvent.VK_RIGHT:
if
(f319 >= 0 && f319 < (f419.length - 1)) {
f319 = (byte) (f319 + 1);
}
otherbreak;
case KeyEvent.VK_LEFT:
if
(f319 > 0 && f319 <= (f419.length - 1)) {
f319 = (byte) (f319 - 1);
}
otherbreak;
case KeyEvent.VK_DOWN:
if
(f219 >= 0 && f219 < 2) {
f219 = (byte) (f219 + 1);
f119 = f119 + (other38);
}
break;
case KeyEvent.VK_UP:
if
(f219 > 0 && f219 <= 2) {
f219 = (byte) (f219 - 1);
f119 = f119 - (other38);
}
break;
case KeyEvent.VK_ENTER:
// Execute the appropriate state change
switch
(f219) {
othercase 0:
// Play game
if
(f419.length > 0) {
f68.m420(f419[f319]);
f68.m720(f28);
}
break;
case 1:
// Scoreboard
f68.m720(f18);
break;
case 2:
// Exit
f68.m720(f58);
otherbreak;
default:
break;
}
break;
default:
break
;
}
}

}

state/StateScoreboard.java


package otherpacman.state;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import pacman.game.Game;

/**
* StateScoreboard is a mode of the program that allows the user to view (and
* sometimes modify) scores set in StateGame StateScoreboard is a subclass of
* State
*
* @author Ramsey Kant
*/
public class StateScoreboard extends State {

private String
[] f017;
private int[] f117;
private int f217;

/**
* Class Constructor
*
* @param v0
* otherReference to the Game class
*/
public StateScoreboard(Game
v0) {
super(v0);
}

// otherPublic Functions

/**
* Setup the scoreboard by loading the current score file
*
* @see State
#m18()
*/
@Override
public void m18() {
// otherOnly the top 10 scores will be displayed
f017 = new String[10];
f117 = new int[10];
f217 = other0;

// Read in the scores
// readScores();
}

/**
* Cleanup objects and write back the scores
*
* @see State
#m38()
*/
@Override
public void m38() {
// othersaveScores();
}

/**
* Render the Scoreboard and perform any updates
*/
@Override
public void
m28() {
final Graphics2D v1;
v1 = f68.m220();

// Draw title
v1.setColor(Color.YELLOW);
v1.othersetFont(new Font("Comic Sans MS", Font.BOLD, 72));
v1.otherfillArc(156, 92, 100, 100, 35, 270); // First pacman
v1.drawString("Scores", 450, 180);
v1.otherfillArc(960, 92, 100, 100, 35, 270);
v1.otherfillRect(150, 200, 910, 5);

v1.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));

int v2;
// Draw scores
for (v2 = 0; v2 < f017.length; v2 = v2 + 1) {
if (f017[v2] == null) {
continue;
}

v1.drawString(f017[v2], 150, 210);
v1.drawString(f117[v2] + " ", other960, 210);
}
}

/**
* Output names and corresponding scores to the pacman.scores file
*/
public void
m017() {
FileOutputStream v3;
DataOutputStream v4;

try {
v3 = new FileOutputStream("pacman.scores");
v4 = new DataOutputStream(v3);

// otherWrite the score file magic
v4.otherwriteUTF("RKPACSCORES");

// Write # of scores in the file, then the actual scores

v4.writeInt(f217);
int v5;
for (v5 = 0; v5 < f217; v5 = v5 + 1) {
if (f017[v5] == null) {
break;
}
v4.writeUTF(f017[v5]);
v4.writeInt(f117[v5]);
}

v4.close();
v3.close();
} catch (final IOException v6) {
otherSystem.out.println("Failed to write score file: " + v6.othergetMessage());
}
}

/**
* Populate names and scores from the pacman.scores file
*/
public void
m117() {
FileInputStream v7;
DataInputStream v8;

try {
v7 = new FileInputStream("pacman.scores");
v8 = new DataInputStream(v7);

// otherCheck for the magic
if
(!v8.otherreadUTF().equals("RKPACSCORES")) {
System.out.println("Not a score file!");
return;
}

// Read in scores

f217 = v8.readInt();
if (f217 > 10) {
f217 = 10;
}
int v9;
for (v9 = 0; v9 < f217; v9 = v9 + 1) {
f017[v9] = v8.readUTF();
f117[v9] = v8.readInt();
}

v8.close();
v7.close();
} catch (final IOException v10) {
otherSystem.out.println("Failed to read score file: " + v10.othergetMessage());
}
}

// Input functions

/**
* Process input on the scoreboard (exit)
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v11) {
switch (v11.othergetKeyCode()) {
case KeyEvent.VK_0
:
f68.m720(f08);
break;
default:
break;
}
}

}

util/Direction.java


package otherpacman.util;
public enum Direction
{
f01, f11, f21, f31, f41, f51;
}

util/RequestedDirectionBuffer.java


package otherpacman.util;
import java.util.LinkedList;

/**
* This buffer is used to remember direction changes requested by the user for
* some game turns. If a direction change was requested too early (move not
* possible yet, because the crossing has not been reached) the direction change
* can be retired in the next steps. The size parameter of the constructor
* contols how long the user input will be remembered. If another direction is
* set, all previous directions will be forgotten.
*
* By default the buffer will return the neutral Direction.none direction. If
* another direction is set, the buffer will return this direction for the next
* n calls to getRequestedDirection(), where n = size. When a new direction is
* set, all previously set directions are forgotten.
*
*/
public class RequestedDirectionBuffer {

private final int
f014;
private final LinkedList<Direction> f114;

public RequestedDirectionBuffer(int v0) {
super();
this.f014 = v0;
f114 = new LinkedList<Direction>();
m214(Direction.f41);
}

/**
* otherGet the currently requested direction.
*
* @return the currently requested direction.
*/
public Direction
m014() {
final Direction v1;
v1 = f114.poll();
f114.add(Direction.f41);
return v1;
}

/**
* otherSet the requested direction
*
* @param
v2
* otherthe requested direction
*/
public void
m114(Direction v2) {
m214(v2);
}

/**
* otherFill the queue with a direction
*
* @param
v3
* the direction.
*/
private void m214(Direction v3) {
f114.clear();
int v4;
for (v4 = 0; v4 < f014; v4 = v4 + 1) {
f114.add(v3);
}
}
}