actors/Actor.java


otherpackage pacman.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 f06;

    /** The x-position on the map where the actor gets spawned */
    protected int f16;
    
    /** The y-position on the map where the actor gets spawned */
    protected int f26;

    /** The direction in which the actor is currently oriented. */
    protected Direction f36;
    
    /** The 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 f46;
    
    /** The size of the direction request buffer. */
    private final static int f56 = 6;

    /** The current orientation angle of the actor. Ignored by actors that do
     *  not have to orient (aka ghosts). */
    protected int f66;
    
    /** The x-position delta to the current map cell, caused by movement
     *  in pixels. */
    protected float f76;
    
    /** The y-position delta to the current map cell, caused by movement
     *  in pixels. */
    protected float f86;
    
    /** The movement speed of the actor */
    protected float f96;

    /**
     * Actor Class Constructor
     * 
     * @param v0
     *            Object type that is an actor
     * @param v1
     *            Base color of the actor
     * @param v2
     *            Reference to the global map object
     * @param v3
     *            X coordinate to spawn the actor at
     * @param v4
     *            Y 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);

        f06 = false;

        // Movement
        f16 = v3;
        f26 = v4;
        f36 = Direction.f47;
        f46 = new RequestedDirectionBuffer(f56);
        f66 = 0;
        f76 = 0;
        f86 = 0;
        f96 = (float) (5d * f1920.f59);
    }

    // Getters and Setters

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

    /**
     * Returns the original Y coordinate the Actor was given in the constructor
     * 
     * @return the Y coordinate of the spawn point
     */
    public int m16() {
        return f26;
    }

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

    /**
     * Get dead status
     * 
     * @return True if dead, false if alive
     * @see Actor#m26(boolean)
     */
    public boolean m36() {
        return f06;
    }

    /**
     * Speed 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 m46(float v6) {
        f96 = v6;
    }

    /**
     * Get the current speed of the actor
     * 
     * @return Current speed
     * @see Actor#m46(float)
     */
    public float m56() {
        return f96;
    }

    /**
     * Set 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 m66(Direction v7) {
        f46.m12(v7);
    }

    // Public 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
     *            A x coordinate to move to
     * @param v9
     *            A y coordinate to move to
     * @return True if the move succeeded. False if otherwise
     * @see Map#m199(Actor, int, int)
     */
    public boolean m76(int v8, int v9) {
        final boolean v10;
		v10 = f1920.m199(this, v8, v9);
        if (v10) {
            f1720 = v8;
            f1820 = v9;
        }
        return v10;
    }

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

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

}

actors/Ghost.java


otherpackage pacman.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 f04;
    private int f14;
    private boolean f24;

    // State
    private boolean f34;
    private boolean f44;
    private boolean f54;

    /**
     * Class constructor
     * 
     * @param v0
     *            Color of the ghost's 'body'
     * @param v1
     *            Reference to the map
     * @param v2
     *            X coordinate to spawn at
     * @param v3
     *            Y coordinate to spawn at
     * @param v4
     *            Set trapped status
     */
    public Ghost(Color v0, Map v1, int v2, int v3, boolean v4) {
        super(GameObject.f420, v0, v1, v2, v3);
        f24 = true;
        f44 = false;
        f34 = v4;
        f54 = false;
    }

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

    /**
     * Set fear status. AIManager interperates this setting for behavior
     * 
     * @param v5
     *            Fear status, true if fearful
     */
    public void m14(boolean v5) {
        f44 = v5;
    }

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

    /**
     * Set the current trapped status
     * 
     * @param v6
     *            Trye uf the ghost is in the spawn-jail
     */
    public void m34(boolean v6) {
        f34 = v6;
    }

    /**
     * Flag 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 m44() {
        return f24;
    }

    /**
     * Update the Path object for the ghost to follow'
     * 
     * @param v7
     *            Path object generated in process() by the AIManager
     * @see AIManager#m20()
     */
    public void m54(Path v7) {
        f14 = 1;
        f04 = v7;
        f24 = false;
    }

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

    /**
     * Run a think cycle for the AI. Major decisions are made by the AIManager
     * (pathing), this just determines movement and screen draw deltas
     * 
     * @see Actor#m520()
     */
    @Override
    public void m520() {
        // Move to the next step
        if (f04 != null && f14 < f04.m010()) {

            // Figure out the direction
            if ((f04.m310(f14) - f1820) < 0) {
                f36 = Direction.f07;
            } else if ((f04.m310(f14) - f1820) > 0) {
                f36 = Direction.f27;
            } else if ((f04.m210(f14) - f1720) > 0) {
                f36 = Direction.f17;
            } else {
                f36 = Direction.f37;
            }

            // Based on the direction, move the screen delta's and the X,Y
            // coordinates if the # of pixels for the cell have been surpassed
            switch (f36) {
                case f07:
                    f76 = 0;
                    f86 -= 0 - f96;
                    // If 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(f86) >= f1920.f29) {
                        f86 = 0;
                        m76(f1720, f1820 - 1);
                        f14 = f14 + 1;
                    }
                    break;
                case f17:
                    f76 += 0 + f96;
                    f86 = 0;
                    if (Math.abs(f76) >= f1920.f29) {
                        f76 = 0;
                        m76(f1720 + 1, f1820);
                        f14 = f14 + 1;
                    }
                    break;
                case f27:
                    f76 = 0;
                    f86 += 0 + f96;
                    if (Math.abs(f86) >= f1920.f29) {
                        f86 = 0;
                        m76(f1720, f1820 + 1);
                        f14 = f14 + 1;
                    }
                    break;
                case f37:
                    f76 -= 0 - f96;
                    f86 = 0;
                    if (Math.abs(f76) >= f1920.f29) {
                        f76 = 0;
                        m76(f1720 - 1, f1820);
                        f14 = f14 + 1;
                    }
                    break;
                case f57:
                case f47:
                    // do not move
            }
        } else {
            f24 = true;
        }
    }

    /**
     * Draw the ghost
     * 
     * @see GameObject#m620(Graphics2D)
     */
    @Override
    public void m620(Graphics2D v9) {
        final int v10;
		v10 = (int) ((f1920.f29 * f1720) + f76);
        final int v11;
		v11 = (int) ((f1920.f29 * f1820) + f86);

        v9.setColor(f1620);

        // Body
        if (f44) {
            v9.setColor(Color.WHITE);
        }
        v9.fillArc(v10, v11, f1920.f29, f1920.f29, 0, 360);
        v9.fillRect((int) ((f1920.f29 * f1720) + f76), (int) ((f1920.f29 * f1820)
                + (f1920.f29 / 2) + f86), f1920.f29, f1920.f29 / 2);

        // Eyes
        if (f44) {
            v9.setColor(Color.BLACK);
        } else {
            v9.setColor(Color.WHITE);
        }
        v9.fillOval((int) ((f1920.f29 * f1720) + 4 + f76),
                (int) ((f1920.f29 * f1820) + 3 + f86), 8, 10);
        v9.fillOval((int) ((f1920.f29 * f1720) + 12 + f76),
                (int) ((f1920.f29 * f1820) + 3 + f86), 8, 10);

        // Eyeballs
        v9.setColor(Color.BLUE);
        v9.fillOval((int) ((f1920.f29 * f1720) + 7 + f76),
                (int) ((f1920.f29 * f1820) + 6 + f86), 4, 4);
        v9.fillOval((int) ((f1920.f29 * f1720) + 13 + f76),
                (int) ((f1920.f29 * f1820) + 6 + f86), 4, 4);

        // Debug draw path
        if (f54 && f04 != null) {
            int v12;
			v12 = 0;
			while (v12 < f04.m010()) {
				final Path.Step otherv13;
				v13 = f04.m110(v12);
				v9.setColor(f1620);
				v9.drawLine(f1920.f29 * v13.m010(), f1920.f29 * v13.m110(),
						(f1920.f29 * v13.m010()) + f1920.f29,
						(f1920.f29 * v13.m110()) + f1920.f29);
				v12 = v12 + 1;
			}
        }
    }
}

actors/Player.java


otherpackage pacman.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 f015; // Current score - Only valid for the current life /
                          // level. StateGame will pull this on death or on
                          // level change
    private boolean f115; // Powered up
    private long f215;

    /**
     * Class Constructor for Player
     * 
     * @param v0
     *            Reference to the map object
     * @param v1
     *            X coordiante to spawn the player at
     * @param v2
     *            Y coordinate to spawn the player at
     */
    public Player(Map v0, int v1, int v2) {
        super(f320, Color.yellow, v0, v1, v2);

        // State
        f015 = 0;
        f115 = false;
        f215 = 0;
    }

    // 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
     *            Amount to increment
     */
    public void m015(int v3) {
        f015 = f015 + (v3);
    }

    /**
     * Get the current level score of the player
     * 
     * @return the score
     */
    public int m115() {
        return f015;
    }

    /**
     * Returns 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 m215() {
        return f115;
    }

    /**
     * Set powered up state and start the expirtation time for when the powerup
     * wears off
     * 
     * @param v4
     *            True if powered up, false if otherwise
     * @see Player#m215()
     */
    public void m315(boolean v4) {
        f115 = v4;
        // If powered up, start the timer and increase speed temporarily
        if (f115) {
            f215 = System.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 m520() {
        final Actor v5;
		v5 = f1920.m139(f1720, f1820, true);
        if (v5 != null && v5.m020() == GameObject.f420) {
            // Notify the State of the loss if pacman isn't powered up
            if (!f115) {
                m26(true);
                return;
            } else {
                v5.m26(true);
            }
        }

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

        boolean v6;
		v6 = false;
        final Item v7;
		v7 = f1920.m109(f1720, f1820);
        if (v7 != null) {
            v6 = v7.m312(this);
        }

        // Update the item's state in the map (remove if itemDestroy is true)
        if (v6) {
            f1920.m159(f1720, f1820);
        }

        final Direction v8;
		v8 = f46.m02();
        if (v8 != Direction.f47) {
            if (f1920.m209(this, v8)) {
                f36 = v8;
            }
        }

        // Based 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 (f36) {
            case f07:
                // Move in the direction only if the next map cell in this
                // direction is reachable (not occupied by a wall)
                if (f1920.m199(this, f1720, f1820 - 1)) {
                    f76 = 0;
                    f86 -= 0 - f96;
                    // If 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(f86) >= f1920.f29) {
                        f86 = 0;
                        m76(f1720, f1820 - 1);
                    }
                }
                f66 = 90;
                break;
            case f17:
                if (f1920.m199(this, f1720 + 1, f1820)) {
                    f76 += 0 + f96;
                    f86 = 0;
                    if (Math.abs(f76) >= f1920.f29) {
                        f76 = 0;
                        m76(f1720 + 1, f1820);
                    }
                }
                f66 = 0;
                break;
            case f27:
                if (f1920.m199(this, f1720, f1820 + 1)) {
                    f76 = 0;
                    f86 += 0 + f96;
                    if (Math.abs(f86) >= f1920.f29) {
                        f86 = 0;
                        m76(f1720, f1820 + 1);
                    }
                }
                f66 = -90;
                break;
            case f37:
                if (f1920.m199(this, f1720 - 1, f1820)) {
                    f76 -= 0 - f96;
                    f86 = 0;
                    if (Math.abs(f76) >= f1920.f29) {
                        f76 = 0;
                        m76(f1720 - 1, f1820);
                    }
                }
                f66 = 180;
                break;
            case f57:
            case f47:
                // do not move
        }
    }

    /**
     * Draw & animate pacman
     * 
     * @param v9
     *            The graphics context
     * @see Actor#m520()
     */
    @Override
    public void m620(Graphics2D v9) {
        final int v10;
		v10 = (int) ((f1920.f29 * f1720) + f76);
        final int v11;
		v11 = (int) ((f1920.f29 * f1820) + f86);

        v9.setColor(f1620);

        // Animate 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(f76) >= f1920.f29 / 2) || Math.abs(f86) >= f1920.f29 / 2) {
            v9.fillArc(v10, v11, f1920.f29, f1920.f29, 0 + f66, 360); // flap
                                                                                           // closed
        } else {
            v9.fillArc(v10, v11, f1920.f29, f1920.f29, 35 + f66, 270);
        }
    }
}

ai/AIManager.java


otherpackage pacman.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
     *            Reference to the map object being used by the game
     * @param v1
     *            Reference to the player
     * @param v2
     *            Set 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;
    }

    // Getters and Setters

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

    /**
     * Set the global map and player references. Ghosts being tracked (in the
     * 'ghosts' ArrayList) will be updated
     * 
     * @param v4
     *            Reference to the map
     * @param v5
     *            Reference 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.m29();
        int v7;
		v7 = 0;
		while (v7 < v6) {
			final Actor v8;
			v8 = f00.m119(v7);
			if (v8.m020() == GameObject.f420) {
				f40.add((Ghost) v8);
			}
			v7 = v7 + 1;
		}
    other}

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

        boolean v9;
		v9 = false;
        if (f00.m129().m215()) {
            v9 = true;
        }

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

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

                // Clear path and move to jail
                v11.otherm54(null);
                v11.m76(v12, v13);
                v11.m34(true);
                v11.m26(false);
            }

            // Any ghost not trapped is given the current fear status
            if (!v11.m24()) {
                // If fear switches from false to true for this ghost, abandon
                // their current (and likely) chase path
                if (!v11.m04() && v9) {
                    v11.m54(null);
                }
                v11.m14(v9);
            } else {
                v11.m14(false);
            }

            // Develop path for ghost
            if (!v11.m24() && v11.m44()) {
                int v15;
				v15 = f10.m320();
                int v16;
				v16 = f10.m420();
                // 45% chance of randomizing a destination, or if they are
                // fearful
                if (v9 || Math.random() < 0.45) {
                    v15 = (int) (Math.random() * f00.m09());
                    v16 = (int) (Math.random() * f00.m19());
                }
                final Path v17;
				v17 = f30.m05(v11, v11.m320(), v11.m420(), v15, v16);
                v11.m54(v17);
            }

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

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

ai/AStarHeuristic.java


otherpackage pacman.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
     *            The map on which the path is being found
     * @param v1
     *            The entity that is moving along the path
     * @param v2
     *            The x coordinate of the tile being evaluated
     * @param v3
     *            The y coordinate of the tile being evaluated
     * @param v4
     *            The x coordinate of the target location
     * @param v5
     *            Teh y coordinate of the target location
     * @return The cost associated with the given tile
     */
    public float m017(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


otherpackage pacman.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 f016 = 1L;
    private final StateEditor f116;
    private JMenuItem f216;
    private JTextArea f316;
    private JTextField f416;
    private JLabel f516;
    private JLabel f616;
    private JLabel f716;
    private JButton f816;
    private JButton f916;
    private JTextField f1016;
    private JButton f1116;
    private JButton f1216;
    private JComboBox f1316;
    private JButton f1416;
    private JComboBox f1516;
    private JCheckBox f1616;
    private JLabel f1716;
    private JButton f1816;
    private JLabel f1916;
    private JMenuItem f2016;
    private JSeparator f2116;
    private JMenuItem f2216;
    private JMenuItem f2316;
    private JMenu f2416;
    private JMenuBar f2516;
    private JLabel f2616;
    private JSeparator f2716;
    private JButton f2816;
    private JButton f2916;
    private JButton f3016;

    public EditorFrame(StateEditor v0) {
        super();
        f116 = v0;
        m016();
    }

    private void m016() {
        try {
            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) {
                    f116.m03().m713(State.f53);
                }
            });
            {
                f2516 = new JMenuBar();
                setJMenuBar(f2516);
                {
                    f2416 = new JMenu();
                    f2516.add(f2416);
                    f2416.setText("File");
                    {
                        f2316 = new JMenuItem();
                        f2416.add(f2316);
                        f2316.setText("Load");
                    }
                    {
                        f2216 = new JMenuItem();
                        f2416.add(f2216);
                        f2216.setText("Save");
                    }
                    {
                        f216 = new JMenuItem();
                        f2416.add(f216);
                        f216.setText("Save As..");
                    }
                    {
                        f2116 = new JSeparator();
                        f2416.add(f2116);
                    }
                    {
                        f2016 = new JMenuItem();
                        f2416.add(f2016);
                        f2016.setText("Exit");
                    }
                }
            }
            {
                f3016 = new JButton();
                getContentPane().add(f3016);
                f3016.setText("Wall");
                f3016.setBounds(12, 218, 59, 23);
                f3016.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v2) {
                        f116.m018(GameObject.f620);
                    }
                });
            }
            {
                f2916 = new JButton();
                getContentPane().add(f2916);
                f2916.setText("Dot");
                f2916.setBounds(12, 36, 59, 23);
                f2916.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v3) {
                        f116.m018(GameObject.f020);
                    }
                });
            }
            {
                f2816 = new JButton();
                getContentPane().add(f2816);
                f2816.setText("Pacman");
                f2816.setBounds(136, 36, 110, 23);
                f2816.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v4) {
                        f116.m018(GameObject.f320);
                    }
                });
            }
            {
                f2716 = new JSeparator();
                getContentPane().add(f2716);
                f2716.setBounds(12, 301, 360, 10);
            }
            {
                f2616 = new JLabel();
                getContentPane().add(f2616);
                f2616.setText("Placeable Objects");
                f2616.setBounds(12, 12, 129, 16);
            }
            {
                f1916 = new JLabel();
                getContentPane().add(f1916);
                f1916.setText("Wall Type");
                f1916.setBounds(12, 196, 82, 16);
            }
            {
                final ComboBoxModel v5;
				v5 = new DefaultComboBoxModel(new String[] {
						"Vertical", "Horizontal", "Top Left", "Top Right",
						"Bottom Left", "Bottom Right", "Ghost Barrier" });
                f1316 = new JComboBox();
                getContentPane().add(f1316);
                f1316.setModel(v5);
                f1316.setBounds(12, 246, 153, 23);
                f1316.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v6) {
                        final String v7;
						v7 = (String) f1316.getSelectedItem();
                        if (v7.equals("Vertical")) {
                            f116.m118(GameObject.f820);
                        } else if (v7.equals("Horizontal")) {
                            f116.m118(GameObject.f920);
                        } else if (v7.equals("Top Left")) {
                            f116.m118(GameObject.f1020);
                        } else if (v7.equals("Top Right")) {
                            f116.m118(GameObject.f1120);
                        } else if (v7.equals("Bottom Left")) {
                            f116.m118(GameObject.f1220);
                        } else if (v7.equals("Bottom Right")) {
                            f116.m118(GameObject.f1320);
                        } else if (v7.equals("Ghost Barrier")) {
                            f116.m118(GameObject.f1420);
                        } else {
                            f116.m118(GameObject.f920);
                        }
                    }
                });
            }
            {
                f1216 = new JButton();
                getContentPane().add(f1216);
                f1216.setText("Save");
                f1216.setBounds(12, 317, 70, 23);
                f1216.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v8) {
                        f116.m718(f1016.getText());
                    }
                });
            }
            {
                f1116 = new JButton();
                getContentPane().add(f1116);
                f1116.setText("Load");
                f1116.setBounds(87, 317, 68, 23);
                f1116.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v9) {
                        f116.m818(f1016.getText());
                    }
                });
            }
            {
                f1016 = new JTextField();
                getContentPane().add(f1016);
                f1016.setBounds(12, 345, 225, 23);
                f1016.setText("test.map");
            }
            {
                f916 = new JButton();
                getContentPane().add(f916);
                f916.setText("New");
                f916.setBounds(160, 317, 71, 23);
                f916.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v10) {
                        f116.m618(28, 31);
                    }
                });
            }
            {
                f816 = new JButton();
                getContentPane().add(f816);
                f816.setText("Teleport");
                f816.setBounds(237, 218, 110, 23);
                f816.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v11) {
                        f116.m018(GameObject.f720);
                        f116.m518(Integer.parseInt(f416.getText()),
                                Integer.parseInt(f316.getText()));
                    }
                });
            }
            {
                f716 = new JLabel();
                getContentPane().add(f716);
                f716.setText("Teleport Settings");
                f716.setBounds(237, 196, 123, 16);
            }
            {
                f616 = new JLabel();
                getContentPane().add(f616);
                f616.setText("Dest X:");
                f616.setBounds(237, 249, 60, 16);
            }
            {
                f516 = new JLabel();
                getContentPane().add(f516);
                f516.setText("Dest Y: ");
                f516.setBounds(235, 279, 52, 16);
            }
            {
                f416 = new JTextField();
                getContentPane().add(f416);
                f416.setText("13");
                f416.setBounds(280, 246, 85, 23);
            }
            {
                f316 = new JTextArea();
                getContentPane().add(f316);
                f316.setText("17");
                f316.setBounds(280, 275, 82, 20);
            }
            {
                f1816 = new JButton();
                getContentPane().add(f1816);
                f1816.setText("Powerup");
                f1816.setBounds(12, 65, 102, 23);
                f1816.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v12) {
                        f116.m018(GameObject.f120);
                    }
                });
            }
            {
                f1716 = new JLabel();
                getContentPane().add(f1716);
                f1716.setText("Ghost Settings");
                f1716.setBounds(272, 12, 76, 16);
            }
            {
                f1616 = new JCheckBox();
                getContentPane().add(f1616);
                f1616.setText("Trapped");
                f1616.setBounds(360, 10, 100, 20);
                f1616.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v13) {
                        f116.m318(!f116.m418());
                        System.out.println(f116.m418());
                    }
                });
            }
            {
                final ComboBoxModel v14;
				v14 = new DefaultComboBoxModel(new String[] {
						"Blinky", "Pinky", "Inky", "Clyde" });
                f1516 = new JComboBox();
                getContentPane().add(f1516);
                f1516.setModel(v14);
                f1516.setBounds(272, 65, 146, 23);
                f1516.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v15) {
                        final String v16;
						v16 = (String) f1516.getSelectedItem();
                        f116.m218(v16);
                    }
                });
            }
            {
                f1416 = new JButton();
                getContentPane().add(f1416);
                f1416.setText("Add Ghost");
                f1416.setBounds(272, 36, 146, 23);
                f1416.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v17) {
                        f116.m018(GameObject.f420);
                    }
                });
            }
            pack();
            this.setSize(451, 547);
        } catch (final Exception v18) {
            // add your error handling code here
            v18.printStackTrace();
        }
    }

}

editor/EditorMarker.java


otherpackage pacman.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
     *            Color of the marker
     * @param v1
     *            Reference to the map object
     * @param v2
     *            X coordinate to initially place the marker
     * @param v3
     *            Y coordinate to initially place the marker
     */
    public EditorMarker(Color v0, Map v1, int v2, int v3) {
        super(GameObject.f520, v0, v1, v2, v3);
    }

    // Public 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
     *            Amount to change the current X coordinate by
     * @param v5
     *            Amount to change the current Y coordinate by
     * @see StateEditor#keyPressed(KeyEvent)
     */
    public void m014(int v4, int v5) {
        // Check bounds
        if (f1720 + v4 < 0 || f1820 + v5 < 0 || f1720 + v4 >= f1920.m09()
                || f1820 + v5 >= f1920.m19()) {
            return;
        }

        f1720 = f1720 + (v4);
        f1820 = f1820 + (v5);
    }

    /**
     * EditorMarker has a blank act() method
     * 
     * @see GameObject#m520()
     */
    @Override
    public void m520() {
        // do nothing
    }

    /**
     * EditorMarker appears as a circle around the tile being edited. The color
     * is set in the constructor
     * 
     * @see GameObject#m620(Graphics2D)
     */
    @Override
    public void m620(Graphics2D v6) {
        final int v7;
		v7 = (f1920.f29 * f1720);
        final int v8;
		v8 = (f1920.f29 * f1820);

        v6.setColor(f1620);

        v6.drawOval(v7, v8, f1920.f29, f1920.f29);
    }

}

game/Game.java


otherpackage pacman.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 f013 = 1L;

    // Debug vars
    private boolean f113;

    // Threading
    private boolean f213;

    // Graphics variables
    private Frame f313;
    public final int f413;
    public final int f513;
    private BufferStrategy f613;

    // State
    private int f713;
    private State f813;
    private boolean f913;
    private int f1013;
    private String f1113;

    /**
     * Class 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#m013()
     */
    public Game(int v0, int v1) {
        // Set resolution settings
        f413 = v0;
        f513 = v1;

        // Init game
        m013();
    }

    /**
     * Startup functionality for the program called by the constructor
     */
    private void m013() {
        // Debug vars
        f113 = false;

        f1113 = "test.map";
        f913 = false;

        // Setup the game frame
        f313 = new Frame("Pacman");
        f313.setLayout(null);
        setBounds(0, 0, f413, f513);
        f313.add(this);
        f313.setSize(f413, f513);
        f313.setResizable(false);
        f313.setVisible(true);

        // Set the exit handler with an anonymous class
        f313.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent v2) {
                // Exit main thread
                f213 = false;
            }
        });

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

        f213 = true;
    }

    // Getter and Setter methods

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

    /**
     * Get a 'handle' of the current graphics buffer for drawing
     * 
     * @return The Graphics2D buffer
     */
    public Graphics2D m213() {
        return (Graphics2D) f613.getDrawGraphics();
    }

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

    /**
     * Set the default starting map (set by menu)
     * 
     * @param v3
     *            The name of the map to load (with the .map extension)
     */
    public void m413(String v3) {
        f1113 = v3;
    }

    /**
     * Return the current debug setting
     * 
     * @return True if debug setting is on
     * @see Game#m613()
     */
    public boolean m513() {
        return f113;
    }

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

    // Public Methods

    /**
     * Called by other states to safely change currentState. This is done so the
     * currentState's logic can finish
     * 
     * @see Game#m813()
     */
    public void m713(int v4) {
        f1013 = v4;
        f913 = true;
    }

    /**
     * The main game loop that handles graphics and game state determination
     */
    public void m813() {
    	final long v5;
		v5 = 20;
    	long v6;
		v6 = 0;
    	
        for (; f213;) {
			otherif ((v6 + v5) > System.currentTimeMillis()) {
				continue;
			}
			v6 = System.currentTimeMillis();
			if (f913) {
				f913 = false;
				m913(f1013);
				continue;
			}
			final Graphics2D v7;
			v7 = m213();
			v7.setColor(Color.black);
			v7.fillRect(0, 0, f413, f513);
			f813.m23();
			v7.dispose();
			f613.show();
			try {
				Thread.sleep(10);
			} catch (InterruptedException v8) {
				v8.printStackTrace();
			}
		}
    other}

    // Private Methods

    /**
     * Change the state of the game. Called in mainThreadLogic()
     * 
     * @param v9
     *            The state to set. Must match the static vars above
     * @see Game#m713(int)
     * @see Game#m813()
     */
    private void m913(int v9) {
        // Cleanup for the outgoing state
        if (f813 != null) {
            f313.removeKeyListener(f813);
            removeKeyListener(f813);
            f813.m33();
        }

        // Set the new state type
        f713 = v9;

        // Instance the new state (reset() is called in the construtor)
        switch (f713) {
            case State.f23:
                f813 = new StateGame(this);
                break;
            case State.f13:
                f813 = new 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.f43:
                f813 = new StateEditor(this);
                break;
            case State.f03:
                f813 = new StateMenu(this);
                break;
            case State.f53:
                f813 = null;
                f213 = false;
                break;
            default:
                break;
        }

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

game/GameObject.java


otherpackage pacman.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 f020 = 1;
    public static final int f120 = 2;
    public static final int f220 = 4;
    public static final int f320 = 8;
    public static final int f420 = 16;
    public static final int f520 = 32; // Virtual
    public static final int f620 = 64; // Virtual
    public static final int f720 = 128;

    // Wall types (Walls aren't instanced GameObject's)
    public static final byte f820 = 1;
    public static final byte f920 = 2;
    public static final byte f1020 = 3;
    public static final byte f1120 = 4;
    public static final byte f1220 = 5;
    public static final byte f1320 = 6;
    public static final byte f1420 = 7;

    // Generic object attributes
    protected int f1520;
    protected Color f1620;
    protected int f1720;
    protected int f1820;

    // Outside refereneces
    protected final Map f1920; // Can 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 m020() {
        return f1520;
    }

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

    /**
     * Set the current base color used when rendering the object
     * 
     * @param v0
     *            java.awt.Color Color of object
     */
    public void m220(Color v0) {
        f1620 = v0;
    }

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

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

    // Public & Protected Abstract methods

    /**
     * Class Constructor for a game object
     * 
     * @param v1
     *            Type of game object (see static types above)
     * @param v2
     *            Standard java Color
     * @param v3
     *            Reference to the global Map
     * @param v4
     *            Initial x coordinate
     * @param v5
     *            Initial y coordinate
     */
    public GameObject(int v1, Color v2, Map v3, int v4, int v5) {
        f1520 = v1;
        f1620 = v2;
        f1920 = v3;
        f1720 = v4;
        f1820 = v5;
    }

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

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

game/Item.java


otherpackage pacman.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 f012;
    private int f112;

    /**
     * Class constructor for Item
     * 
     * @param v0
     *            Object type
     * @param v1
     *            Base color of the item
     * @param v2
     *            Reference to the map object
     * @param v3
     *            X coordinate the item will occupy on the map
     * @param v4
     *            Y 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);

        f012 = 13;
        f112 = 17;
    }

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

    /**
     * Retrieve the teleport destination X coordinate
     * 
     * @return X destination coordinate
     * @see Item#m012(int, int)
     */
    public int m112() {
        return f012;
    }

    /**
     * Retrieve the teleport destination Y coordinate
     * 
     * @return Y destination coordinate
     * @see Item#m012(int, int)
     */
    public int m212() {
        return f112;
    }

    /**
     * Called 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
     *            Player that uses the item
     * @return True->Destroy the item. False->Keep the item on the map
     * @see Player#m520()
     */
    public boolean m312(Player v7) {
        boolean v8;
		v8 = false;

        // Perform action based on type
        switch (f1520) {
            case f020:
                v7.m015(10);
                v8 = true;
                break;
            case f120:
                v7.m015(50);
                v7.m315(true);
                v8 = true;
                break;
            case f720:
                v7.m76(f012, f112);
                break;
            default:
                break;
        }

        return v8;
    }

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

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

        final int v10;
		v10 = (f1720 * f1920.f29) + f1920.f29 / 2;
        final int v11;
		v11 = (f1820 * f1920.f29) + f1920.f29 / 2;

        // Render item based on type
        switch (f1520) {
            case f020:
                v9.fillArc(v10 - 4, v11 - 4, 8, 8, 0, 360);
                break;
            case f120:
                v9.fillArc(v10 - 8, v11 - 8, 16, 16, 0, 360);
                break;
            case f720:
                v9.fillOval(v10 - 6, v11 - 8, 12, 16);
                break;
            default:
                break;
        }
    }

}

game/JPacmanGame.java


otherpackage pacman.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.m713(State.f03);
        v1.m813();
        System.exit(0);
    }
}

map/Map.java


otherpackage pacman.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 f09;
    private int f19;
    public final int f29;
    public final int f39;
    public final int f49;
    public final double f59;

    // Instance vars
    private byte f69[][];
    private Item f79[][];
    private ArrayList<Actor> f89;
    private int f99;

    /**
     * Class constructor, inits a blank map based on a width, height, and cell
     * size Used in the editor
     * 
     * @param v0
     *            Width of the map
     * @param v1
     *            Height of the map
     * @param cs
     *            Size of individual cells in pixels
     */
    public Map(int v0, int v1, double v2) {
        // Set map parameters
        f09 = v0;
        f19 = v1;
        f59 = v2;
        f29 = (int) (32 * v2);
        f39 = (int) (12 * v2);
        f49 = (int) (10 * v2);
        f99 = 0;

        // Initialize collideMap, a 2D array that contains all static collidable
        // GameObjects
        // We use this for fast lookup during collision detection and AI
        // movement paths
        f69 = new byte[f09][f19];

        // Initialize itemMap, a 2D array that contains items (dots, powerups,
        // cherry) on the map
        f79 = new Item[f09][f19];

        // Create m_objects, an arraylist with all actorList
        f89 = new ArrayList<Actor>();
    }

    /**
     * Class Constructor that reads the map data from filename
     * 
     * @param v3
     *            The 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
        f59 = v4;
        f29 = (int) (32 * v4);
        f39 = (int) (12 * v4);
        f49 = (int) (10 * v4);

        // Read contents of the map file
        m249(v3);
    }

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

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

    /**
     * Get the number of actorList on the map (the size of the actorList
     * ArrayList)
     * 
     * @return Number of actorList
     */
    public int m29() {
        return f89.size();
    }

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

    /**
     * Return the item map (a 2D array of Item objects)
     * 
     * @return item map (itemMap)
     */
    public Item[][] m49() {
        return f79;
    }

    /**
     * Return 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 m59() {
        return f99;
    }

    /**
     * Add a collidable (by type) to the collideMap
     * 
     * @param v5
     *            X coordinate
     * @param v6
     *            Y coordinate
     * @param v7
     *            Type of collidable
     * @return True if successful
     */
    public boolean m69(int v5, int v6, byte v7) {
        // Check bounds
        if (v5 < 0 || v6 < 0 || v5 >= f09 || v6 >= f19) {
            return false;
        }

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

        // Add to the collideMap
        f69[v5][v6] = v7;
        return true;
    }

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

        final int v9;
		v9 = v8.m320();
        final int v10;
		v10 = v8.m420();
        if (v9 < 0 || v10 < 0 || v9 >= f09 || v10 >= f19) {
            return false;
        }

        // Add to the itemMap
        if (v8.m020() == GameObject.f020) {
            f99 = f99 + 1;
        }
        f79[v9][v10] = v8;
        return true;
    }

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

        final int v12;
		v12 = v11.m320();
        final int v13;
		v13 = v11.m420();
        if (v12 < 0 || v13 < 0 || v12 >= f09 || v13 >= f19) {
            return false;
        }

        // Add to the array list
        f89.add(v11);
        return true;
    }

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

        return f69[v14][v15];
    }

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

        return f79[v16][v17];
    }

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

    /**
     * Find and return the player object within the local actorList ArrayList
     * 
     * @return The player object. null if not found
     */
    public Player m129() {
        // Get from the object map
        for (final Actor v21 : f89) {
            if (v21.m020() == GameObject.f320) {
                return (Player) v21;
            }
        }

        return null;
    }

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

        // Get from the object map
        for (final Actor v25 : f89) {
            if (v24 && v25.m020() == GameObject.f320) {
                continue;
            }

            if (v25.m320() == v22 && v25.m420() == v23) {
                return v25;
            }
        }

        return 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
     *            Index of the actor
     */
    public void m149(int v26) {
        f89.remove(v26);
    }

    /**
     * Remove an item from the item array by coordinate (x, y)
     * 
     * @param v27
     *            X coordinate of the item
     * @param v28
     *            Y coordinate of the item
     */
    public void m159(int v27, int v28) {
        // Check bounds
        if (v27 < 0 || v28 < 0 || v27 >= f09 || v28 >= f19) {
            return;
        }

        if (f79[v27][v28].m020() == GameObject.f020) {
            f99 = f99 - 1;
        }

        f79[v27][v28] = null;
    }

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

        // Check bounds
        if (v29 < 0 || v30 < 0 || v29 >= f09 || v30 >= f19) {
            return false;
        }

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

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

        int v32;
		v32 = 0;
		while (v32 < f89.size()) {
			Actor otherv33;
			v33 = f89.get(v32);
			if (v33.m320() == v29 && v33.m420() == v30) {
				f89.remove(v32);
				v33 = null;
				v32 = v32 - 1;
				v31 = true;
			}
			v32 = v32 + 1;
		}

        otherreturn v31;
    }

    /**
     * Find the distance (Manhattan) between two objects
     * 
     * @param v34
     *            GameObject at the initial position
     * @param v35
     *            GameObject at the end position
     * @return Distance (integer)
     */
    public int m179(GameObject v34, GameObject v35) {
        return (int) Math.sqrt(Math.pow(Math.abs(v34.m320() - v35.m320()), 2)
                + Math.pow(Math.abs(v34.m420() - v35.m420()), 2));
    }

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

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

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

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

        return true;
    }

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

        // Check bounds
        if (!m219(v39, v40)) {
            return false;
        }

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

        // Allow the Actor to move
        return true;
    }

    public boolean m209(Actor v41, Direction v42) {
        int v43;
		v43 = v41.m320();
        int v44;
		v44 = v41.m420();
        switch (v42) {
            case f07:
                v44 = v44 - 1;
                break;
            case f17:
                v43 = v43 + 1;
                break;
            case f27:
                v44 = v44 + 1;
                break;
            case f37:
                v43 = v43 - 1;
                break;
            case f47:
                return true;
        }

        return m199(v41, v43, v44);
    }

    private boolean m219(int v45, int v46) {
        return v45 > 0 && v46 > 0 && v45 <= f09 && v46 <= f19;
    }

    /**
     * Get 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
     *            The mover that is trying to move across the tile
     * @param v48
     *            The x coordinate of the tile we're moving from
     * @param v49
     *            The y coordinate of the tile we're moving from
     * @param v50
     *            The x coordinate of the tile we're moving to
     * @param v51
     *            The y coordinate of the tile we're moving to
     * @return The relative cost of moving across the given tile
     */
    public float m229(Actor v47, int v48, int v49, int v50, int v51) {
        return 1;
    }

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

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

            // Write the map file magic
            v54.writeUTF("RKPACMAP");

            // Write map width & height
            v54.writeInt(f09);
            v54.writeInt(f19);

            int v55;
			v55 = 0;
			while (v55 < f09) {
				int v56;
				v56 = 0;
				while (v56 < f19) {
					v54.write(f69[v55][v56]);
					v56 = v56 + 1;
				}
				v55 = v55 + 1;
			}

            Item v57;
			v57 = null;
            int v58;
			v58 = 0;
			while (v58 < f09) {
				int v59;
				v59 = 0;
				while (v59 < f19) {
					v57 other= f79[v58][v59];
					if (v57 == null) {
						v54.writeBoolean(false);
						continue;
					}
					v54.writeBoolean(true);
					v54.writeInt(v57.m020());
					v54.writeInt(v57.m320());
					v54.writeInt(v57.m420());
					v54.writeInt(v57.m120().getRGB());
					if (v57.m020() == GameObject.f720) {
						v54.writeInt(v57.m112());
						v54.writeInt(v57.m212());
					}
					v59 = v59 + 1;
				}
				v58 = v58 + 1;
			}

            // Write the number of actorList, then all actor data
            v54.otherwriteInt(f89.size());
            for (final Actor v60 : f89) {
                v54.writeInt(v60.m020());
                v54.writeInt(v60.m320());
                v54.writeInt(v60.m420());
                v54.writeInt(v60.m120().getRGB());
                if (v60.m020() == GameObject.f420) {
                    v54.writeBoolean(((Ghost) v60).m24());
                }
            }

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

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

        FileInputStream v63;
        DataInputStream v64;

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

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

            // Read map width & height
            f09 = v64.readInt();
            f19 = v64.readInt();
            f99 = 0;

            // Initialize collideMap, a 2D array that contains all static
            // collidable GameObjects
            // We use this for fast lookup during collision detection and AI
            // movement paths
            f69 = new byte[f09][f19];

            // Initialize itemMap, a 2D array that contains items (dots,
            // powerups, cherry) on the map
            f79 = new Item[f09][f19];

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

            int v65;
			v65 = 0;
			while (v65 < f09) {
				int v66;
				v66 = 0;
				while (v66 < f19) {
					m69(v65, v66, v64.readByte());
					v66 = v66 + 1;
				}
				v65 = v65 + 1;
			}

            int v67;
			v67 = 0;
			while (v67 < f09) {
				int v68;
				v68 = 0;
				while (v68 < f19) {
					otherif (!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());
					m79(new Item(v69, v72, this, v70, v71));
					if (v69 == GameObject.f720) {
						final int v73;
						v73 = v64.readInt();
						final int v74;
						v74 = v64.readInt();
						f79[v70][v71].m012(v73, v74);
					}
					v68 = v68 + 1;
				}
				v67 = v67 + 1;
			}

            final int v75;
			v75 = v64.readInt();
            int v76;
			v76 = 0;
			while (v76 < v75) {
				final int otherv77;
				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.f320) {
					m89(new Player(this, v78, v79));
				} else if (v77 == GameObject.f420) {
					final boolean v81;
					v81 = v64.readBoolean();
					m89(new Ghost(v80, this, v78, v79, v81));
				}
				v76 = v76 + 1;
			}

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

}

map/Path.java


otherpackage pacman.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> f010;

    /**
     * Create an empty path
     */
    public Path() {
        f010 = new ArrayList<Step>();
    }

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

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

    /**
     * Get the x coordinate for the step at the given index
     * 
     * @param v1
     *            The index of the step whose x coordinate should be retrieved
     * @return The x coordinate at the step
     */
    public int m210(int v1) {
        return m110(v1).f010;
    }

    /**
     * Get the y coordinate for the step at the given index
     * 
     * @param v2
     *            The index of the step whose y coordinate should be retrieved
     * @return The y coordinate at the step
     */
    public int m310(int v2) {
        return m110(v2).f110;
    }

    /**
     * Append a step to the path.
     * 
     * @param v3
     *            The x coordinate of the new step
     * @param v4
     *            The y coordinate of the new step
     */
    public void m410(int v3, int v4) {
        f010.add(new Step(v3, v4));
    }

    /**
     * Prepend a step to the path.
     * 
     * @param v5
     *            The x coordinate of the new step
     * @param v6
     *            The y coordinate of the new step
     */
    public void m510(int v5, int v6) {
        f010.add(0, new Step(v5, v6));
    }

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

    /**
     * A single step within the path
     * 
     * @author Kevin Glass
     */
    public class Step {
        /** The x coordinate at the given step */
        private final int f010;
        /** The y coordinate at the given step */
        private final int f110;

        /**
         * Create a new step
         * 
         * @param v9
         *            The x coordinate of the new step
         * @param v10
         *            The y coordinate of the new step
         */
        public Step(int v9, int v10) {
            this.f010 = v9;
            this.f110 = v10;
        }

        /**
         * Get the x coordinate of the new step
         * 
         * @return The x coodindate of the new step
         */
        public int m010() {
            return f010;
        }

        /**
         * Get the y coordinate of the new step
         * 
         * @return The y coodindate of the new step
         */
        public int m110() {
            return f110;
        }

        /**
         * @see Object#hashCode()
         */
        @Override
        public int hashCode() {
            return f010 * f110;
        }

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

                return (v12.f010 == f010) && (v12.f110 == f110);
            }

            return false;
        }
    }
}

map/PathFinder.java


otherpackage pacman.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> f05;
    /** The set of nodes that we do not yet consider fully searched */
    private final SortedNodeList f15 = new SortedNodeList();

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

    /** The complete set of nodes across the map */
    private final Node[][] f45;
    /** True if we allow diaganol movement */
    private final boolean f55;
    /** The heuristic we're applying to determine which nodes to search first */
    private final AStarHeuristic f65;

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

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

        f05 = new ArrayList<Node>();
        f45 = new Node[v3.m09()][v3.m19()];

        int v7;
		v7 = 0;
		while (v7 < v3.m09()) {
			int v8;
			v8 = 0;
			while (v8 < v3.m19()) {
				f45[v7][v8] = new Node(v7, v8);
				v8 = v8 + 1;
			}
			v7 = v7 + 1;
		}
    other}

    /**
     * Find 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
     *            The 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
     *            The x coordinate of the start location
     * @param v11
     *            The y coordinate of the start location
     * @param v12
     *            The x coordinate of the target location
     * @param v13
     *            Teh y coordinate of the target location
     * @return The path found from start to end, or null if no path can be
     *         found.
     */

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

        if (!f25.m199(v9, v12, v13)) {
            return 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
        f45[v10][v11].f25 = 0;
        f45[v10][v11].f55 = 0;
        f05.clear();
        f15.m15();
        f15.m25(f45[v10][v11]);

        f45[v12][v13].f35 = null;

        int v14;
		v14 = 0;
        for (; (v14 < f35) && (f15.otherm45() != 0);) {
			final Node v15;
			v15 = m15();
			if (v15 == f45[v12][v13]) {
				break;
			}
			m45(v15);
			m55(v15);
			int v16;
			v16 = -1;
			while (v16 < 2) {
				int v17;
				v17 = -1;
				while (v17 < 2) {
					otherif ((v16 == 0) && (v17 == 0)) {
						continue;
					}
					if (!f55) {
						if ((v16 != 0) && (v17 != 0)) {
							continue;
						}
					}
					final int v18;
					v18 = v16 + v15.f05;
					final int v19;
					v19 = v17 + v15.f15;
					if (m85(v9, v10, v11, v18, v19)) {
						final float v20;
						v20 = v15.f25 + m95(v9, v15.f05, v15.f15, v18, v19);
						final Node v21;
						v21 = f45[v18][v19];
						if (v20 < v21.f25) {
							if (m35(v21)) {
								m45(v21);
							}
							if (m65(v21)) {
								m75(v21);
							}
						}
						if (!m35(v21) && !(m65(v21))) {
							v21.f25 = v20;
							v21.f45 = m105(v9, v18, v19, v12, v13);
							v14 = Math.max(v14, v21.m05(v15));
							m25(v21);
						}
					}
					v17 = v17 + 1;
				}
				v16 = v16 + 1;
			}
		}

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

        if (f45[v12][v13].f35 == null) {
            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 = f45[v12][v13];
        for (; v23 != f45[v10][v11];) {
			v22.m510(v23.f05, v23.f15);
			v23 = v23.f35;
		}
        v22.otherm510(v10, v11);

        // thats it, we have our path

        return v22;
    }

    /**
     * Get 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 m15() {
        return (Node) f15.m05();
    }

    /**
     * Add a node to the open list
     * 
     * @param v24
     *            The node to be added to the open list
     */
    protected void m25(Node v24) {
        f15.m25(v24);
    }

    /**
     * Check if a node is in the open list
     * 
     * @param v25
     *            The node to check for
     * @return True if the node given is in the open list
     */
    protected boolean m35(Node v25) {
        return f15.m55(v25);
    }

    /**
     * Remove a node from the open list
     * 
     * @param v26
     *            The node to remove from the open list
     */
    protected void m45(Node v26) {
        f15.m35(v26);
    }

    /**
     * Add a node to the closed list
     * 
     * @param v27
     *            The node to add to the closed list
     */
    protected void m55(Node v27) {
        f05.add(v27);
    }

    /**
     * Check if the node supplied is in the closed list
     * 
     * @param v28
     *            The node to search for
     * @return True if the node specified is in the closed list
     */
    protected boolean m65(Node v28) {
        return f05.contains(v28);
    }

    /**
     * Remove a node from the closed list
     * 
     * @param v29
     *            The node to remove from the closed list
     */
    protected void m75(Node v29) {
        f05.remove(v29);
    }

    /**
     * Check if a given location is valid for the supplied mover
     * 
     * @param v30
     *            The mover that would hold a given location
     * @param v31
     *            The starting x coordinate
     * @param v32
     *            The starting y coordinate
     * @param v33
     *            The x coordinate of the location to check
     * @param v34
     *            The y coordinate of the location to check
     * @return True if the location is valid for the given mover
     */
    protected boolean m85(Actor v30, int v31, int v32, int v33, int v34) {
        boolean v35;
		v35 = (v33 < 0) || (v34 < 0) || (v33 >= f25.m09())
				|| (v34 >= f25.m19());

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

        return !v35;
    }

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

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

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

        /**
         * Retrieve the first element from the list
         * 
         * @return The first element from the list
         */
        public Object m05() {
            return f05.get(0);
        }

        /**
         * Empty the list
         */
        public void m15() {
            f05.clear();
        }

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

        /**
         * Remove an element from the list
         * 
         * @param v47
         *            The element to remove
         */
        public void m35(Object v47) {
            f05.remove(v47);
        }

        /**
         * Get the number of elements in the list
         * 
         * @return The number of element in the list
         */
        public int m45() {
            return f05.size();
        }

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

    /**
     * A single node in the search graph
     */
    private class Node implements Comparable<Object> {
        /** The x coordinate of the node */
        private final int f05;
        /** The y coordinate of the node */
        private final int f15;
        /** The path cost for this node */
        private float f25;
        /** The parent of this node, how we reached it in the search */
        private Node f35;
        /** The heuristic cost of this node */
        private float f45;
        /** The search depth of this node */
        private int f55;

        /**
         * Create a new node
         * 
         * @param v49
         *            The x coordinate of the node
         * @param v50
         *            The y coordinate of the node
         */
        public Node(int v49, int v50) {
            this.f05 = v49;
            this.f15 = v50;
        }

        /**
         * Set the parent of this node
         * 
         * @param v51
         *            The parent node which lead us to this node
         * @return The depth we have no reached in searching
         */
        public int m05(Node v51) {
            f55 = v51.f55 + 1;
            this.f35 = v51;

            return f55;
        }

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

            final float v54;
			v54 = f45 + f25;
            final float v55;
			v55 = v53.f45 + v53.f25;

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

state/State.java


otherpackage pacman.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 f03 = 1;
    public static final int f13 = 2;
    public static final int f23 = 4;
    public static final int f33 = 8;
    // public static final int STATE_GAMEOVER = 16;
    public static final int f43 = 32;
    public static final int f53 = 64;

    protected Game f63;

    /**
     * Class Constructor
     * 
     * @param v0
     *            Reference to the game
     */
    public State(Game v0) {
        f63 = v0;
        m13();
    }

    /**
     * Return the reference to the game object
     * 
     * @return Reference to the game object
     */
    public Game m03() {
        return f63;
    }

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

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

    /**
     * Signals 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 m33();

    /*
     * Human Input default
     */

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

    @Override
    public void keyTyped(KeyEvent v2) {
        // Esc
        switch (v2.getKeyChar()) {
            case 27:
                f63.m713(f53);
                break;
            default:
                break;
        }
    }
}

state/StateEditor.java


otherpackage pacman.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 f018;
    private EditorMarker f118;
    private boolean f218;
    private Map f318;

    // Placement variables
    private int f418;
    private byte f518;
    private String f618;
    private boolean f718;
    private int f818;
    private int f918;

    // Map vars. Store them as class member vars to eliminate function call
    // overhead for getHeight/getWidth
    private int f1018;
    private int f1118;

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

        // If true, remove all editor helpers like grid lines
        f218 = false;

        // Create the editor toolpane
        f63.m113().setSize(1024, f63.f513);
        f018 = new EditorFrame(this);
        f018.setVisible(true);

        // Defaults
        f418 = GameObject.f620;
        f518 = GameObject.f820;
        f618 = "Blinky";
        f718 = false;
        f818 = 13;
        f918 = 17;
    }

    // Getters and Setters

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

    /**
     * Set the type of wall to be placed by the marker Called by the EditorFrame
     * Wall button
     * 
     * @param v2
     *            Type of wall (from GameObject statics)
     */
    public void m118(byte v2) {
        f518 = v2;
    }

    /**
     * Set the type of wall to be placed by the marker Called by the EditorFrame
     * Add Ghost button
     * 
     * @param v3
     *            Type of wall (from GameObject statics)
     */
    public void m218(String v3) {
        f618 = v3;
    }

    /**
     * Toggle the trapped status of the next ghost to be added
     * 
     * @param v4
     *            True if trapped in the spawn-jail
     */
    public void m318(boolean v4) {
        f718 = v4;
    }

    /**
     * Get the current trapped status
     * 
     * @return True if new ghosts will be created as trapped
     */
    public boolean m418() {
        return f718;
    }

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

    /**
     * Reset the StateEditor objects like the Marker
     * 
     * @see State#m13()
     */
    @Override
    public void m13() {
        // Force previous references out of scope
        f118 = null;
        f318 = null;

        f418 = GameObject.f020;
    }

    /**
     * Setup and render a new blank map
     * 
     * @param v7
     *            The width of the map to be created
     * @param v8
     *            The height of the map to be created
     */
    public void m618(int v7, int v8) {
        // Setup the game map
        f63.m213().setBackground(Color.BLACK);
        f1018 = v7;
        f1118 = v8;
        f318 = new Map(28, 31, 32);

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

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

    /**
     * Setup and render a map loaded from the file system
     * 
     * @param v10
     */
    public void m818(String v10) {
        // Setup the game map
        f63.m213().setBackground(Color.BLACK);
        f318 = new Map(System.getProperty("user.dir") + "\\" + v10, 32);
        f1018 = f318.m09();
        f1118 = f318.m19();

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

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

        final Graphics2D v11;
		v11 = f63.m213();

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

        Item v12;
		v12 = null;
        int v13;
		v13 = 0;
		while (v13 < f1018) {
			int v14;
			v14 = 0;
			while (v14 < f1118) {
				final byte otherv15;
				v15 = f318.m99(v13, v14);
				v11.setColor(Color.BLUE);
				switch (v15) {
				case 0:
					break;
				case GameObject.f820:
					v11.fillRoundRect(v13 * f318.f29 + 10, v14 * f318.f29, 12,
							f318.f29, 0, 0);
					break;
				case GameObject.f920:
					v11.fillRoundRect(v13 * f318.f29, v14 * f318.f29 + 10,
							f318.f29, 12, 0, 0);
					break;
				case GameObject.f1020:
					v11.fillRoundRect(v13 * f318.f29 + (f318.f29 / 2), v14
							* f318.f29 + 10, f318.f29 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f318.f29 + 10, v14 * f318.f29
							+ (f318.f29 / 2), 12, f318.f29 / 2, 0, 0);
					break;
				case GameObject.f1120:
					v11.fillRoundRect(v13 * f318.f29, v14 * f318.f29 + 10,
							f318.f29 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f318.f29 + 10, v14 * f318.f29
							+ (f318.f29 / 2), 12, f318.f29 / 2, 0, 0);
					break;
				case GameObject.f1220:
					v11.fillRoundRect(v13 * f318.f29 + (f318.f29 / 2), v14
							* f318.f29 + 10, f318.f29 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f318.f29 + 10, v14 * f318.f29, 12,
							f318.f29 / 2, 0, 0);
					break;
				case GameObject.f1320:
					v11.fillRoundRect(v13 * f318.f29, v14 * f318.f29 + 10,
							f318.f29 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f318.f29 + 10, v14 * f318.f29, 12,
							f318.f29 / 2, 0, 0);
					break;
				case GameObject.f1420:
					v11.setColor(Color.PINK);
					v11.fillRoundRect(v13 * f318.f29, v14 * f318.f29 + 10,
							f318.f29, 6, 0, 0);
					break;
				default:
					break;
				}
				v12 = f318.m109(v13, v14);
				if (v12 != null) {
					v12.m620(v11);
				}
				v14 = v14 + 1;
			}
			v13 = v13 + 1;
		}

        final int v16;
		v16 = f318.m29();
        int v17;
		v17 = 0;
		while (v17 < v16) {
			final Actor v18;
			v18 = f318.m119(v17);
			if (v18 != null) {
				v18.m620(v11);
			}
			v17 = v17 + 1;
		}

        // Paint the marker
        f118.m620(v11);

        // Paint gridline overlay if in editor view
        if (!f218) {
            v11.setColor(Color.RED);
            int v19;
			v19 = 0;
			while (v19 < f1018) {
				v11.drawLine(v19 * f318.f29, 0, v19 * f318.f29, f1118
						* f318.f29);
				v19 = v19 + 1;
			}
            int v20;
			v20 = 0;
			while (v20 < f1118) {
				v11.drawLine(0, v20 * f318.f29, f1018 * f318.f29, v20
						* f318.f29);
				v20 = v20 + 1;
			}

            // Player X,Y coordinates bottom right
            v11.otherdrawString("X: " + f118.m320() + ", Y: " + f118.m420(), 900, 700);
        }
    }

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

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

                // If not empty, bail
                if (!f318.m189(f118.m320(), f118.m420())) {
                    return;
                }

                switch (f418) {
                    case GameObject.f620:
                        f318.m69(f118.m320(), f118.m420(), f518);
                        break;
                    case GameObject.f020:
                        f318.m79(new Item(GameObject.f020, Color.WHITE, f318,
                                f118.m320(), f118.m420()));
                        break;
                    case GameObject.f120:
                        f318.m79(new Item(GameObject.f120, Color.WHITE, f318, f118
                                .m320(), f118.m420()));
                        break;
                    case GameObject.f420:
                        if (f618.equals("Blinky")) {
                            f318.m89(new Ghost(Color.RED, f318, f118.m320(), f118.m420(),
                                    f718));
                        } else if (f618.equals("Pinky")) {
                            f318.m89(new Ghost(Color.PINK, f318, f118.m320(), f118.m420(),
                                    f718));
                        } else if (f618.equals("Inky")) {
                            f318.m89(new Ghost(Color.CYAN, f318, f118.m320(), f118.m420(),
                                    f718));
                        } else {
                            f318.m89(new Ghost(Color.ORANGE, f318, f118.m320(), f118.m420(),
                                    f718));
                        }
                        break;
                    case GameObject.f320:
					int v22;
					v22 = 0;
					while (v22 < f318.m29()) {
						if (f318.m119(v22).m020() == GameObject.f320) {
							f318.m149(v22);
							v22 = v22 - 1;
						}
						v22 = v22 + 1;
					}

                        // Add the new player
                        f318.otherm89(new Player(f318, f118.m320(), f118.m420()));
                        break;
                    case GameObject.f720:
					final Item v23;
					v23 = new Item(GameObject.f720,
							Color.LIGHT_GRAY, f318, f118.m320(), f118.m420());
                        v23.m012(f818, f918);
                        f318.m79(v23);
                        break;

                    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 (f318.m189(f118.m320(), f118.m420())) {
                    return;
                }

                // Remove anything (collidable, actor, or item) at (x,y)
                f318.m169(f118.m320(), f118.m420());
                break;
            case KeyEvent.VK_V:
                f218 = !f218;
                break;
            case KeyEvent.VK_0:
                // editorFrame.setEnabled(false);
                // game.changeState(STATE_MENU);
                break;
            default:
                break;
        }
    }

}

state/StateGame.java


otherpackage pacman.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 f08;
    private Map f18;
    private AIManager f28;

    // Game vars
    private String f38;
    private int f48;
    private int f58; // Overall score for the game session. The player
                              // object score is only the score for that life /
                              // level
    private int f68;
    private boolean f78;
    private long f88;

    // Map vars. Store them as class member vars to eliminate function call
    // overhead for getHeight/getWidth
    private int f98;
    private int f108;

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

    /**
     * Get 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#m28()
     * @see StateGame#m38()
     */
    public int m08() {
        return f58;
    }

    // Public Methods

    /**
     * Reset the state of the game entirely (level 1)
     * 
     * @see State#m13()
     */
    @Override
    public void m13() {
        // Set game vars
        f38 = f63.m313();
        f48 = 0;
        f58 = 0;
        f68 = 99;
        f88 = 0;

        // Respawn (start level 1)
        m18(true);
    }

    /**
     * Respawns the player after a death or win. Similar to reset() except
     * running vars are saved
     * 
     * @param v1
     *            Moves to the next level and corresponding map
     */
    public void m18(boolean v1) {
        f78 = true;
        f88 = System.currentTimeMillis() + 3000;

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

            // Force previous references out of scope
            f08 = null;
            f18 = null;
            f28 = null;

            // Setup the game map
            f63.m213().setBackground(Color.BLACK);
            f18 = new Map(f38, 0.75);
            f98 = f18.m09();
            f108 = f18.m19();

            // Spawn the player
            f08 = f18.m129();

            // Setup AI
            f28 = new AIManager(f18, f08, f63.m513());

            // Slighly increase the game speed

        } else { // Player died, reset the map
            final int v2;
			v2 = f18.m29();
            int v3;
			v3 = 0;
			while (v3 < v2) {
				final Actor otherv4;
				v4 = f18.m119(v3);
				if (v4 != null) {
					v4.m76(v4.m06(), v4.m16());
					v4.m26(false);
					if (v4.m020() == GameObject.f420) {
						((Ghost) v4).m54(null);
					}
				}
				v3 = v3 + 1;
			}
        other}
    }

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

        final Graphics2D v5;
		v5 = f63.m213();

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

        // Paint right UI with lives remaining, score, highscore etc
        v5.setColor(Color.WHITE);
        v5.setFont(new Font("Comic Sans MS", Font.BOLD, 24));
        v5.drawString("PACMAN by Ramsey Kant", 680, 50);
        v5.drawString("Score: " + f08.m115(), 750, 100);
        v5.drawString("Total: " + f58, 750, 150);
        v5.drawString("Lives: " + f68, 750, 200);
        v5.drawString("Level: " + f48, 750, 250);

        // Execute game logic for all entites on the map
        if (!f78) {
            f28.m20();
            f08.m520();
        }

        // Check for player death. End the round if the player is dead
        if (f08.m36()) {
            m38();
            return;
        }

        // Check for a win (all dots collected)
        if (f18.m59() <= 0) {
            m28();
            return;
        }

        Item v6;
		v6 = null;
        int v7;
		v7 = 0;
		while (v7 < f98) {
			int v8;
			v8 = 0;
			while (v8 < f108) {
				final byte otherv9;
				v9 = f18.m99(v7, v8);
				v5.setColor(Color.BLUE);
				switch (v9) {
				case 0:
					break;
				case GameObject.f820:
					v5.fillRoundRect(v7 * f18.f29 + f18.f49, v8 * f18.f29,
							f18.f39, f18.f29, 0, 0);
					break;
				case GameObject.f920:
					v5.fillRoundRect(v7 * f18.f29, v8 * f18.f29 + f18.f49,
							f18.f29, f18.f39, 0, 0);
					break;
				case GameObject.f1020:
					v5.fillRoundRect(v7 * f18.f29 + (f18.f29 / 2), v8 * f18.f29
							+ f18.f49, f18.f29 / 2, f18.f39, 0, 0);
					v5.fillRoundRect(v7 * f18.f29 + f18.f49, v8 * f18.f29
							+ (f18.f29 / 2), f18.f39, f18.f29 / 2, 0, 0);
					break;
				case GameObject.f1120:
					v5.fillRoundRect(v7 * f18.f29, v8 * f18.f29 + f18.f49,
							f18.f29 / 2, f18.f39, 0, 0);
					v5.fillRoundRect(v7 * f18.f29 + f18.f49, v8 * f18.f29
							+ (f18.f29 / 2), f18.f39, f18.f29 / 2, 0, 0);
					break;
				case GameObject.f1220:
					v5.fillRoundRect(v7 * f18.f29 + (f18.f29 / 2), v8 * f18.f29
							+ f18.f49, f18.f29 / 2, f18.f39, 0, 0);
					v5.fillRoundRect(v7 * f18.f29 + f18.f49, v8 * f18.f29, 12,
							f18.f29 / 2, 0, 0);
					break;
				case GameObject.f1320:
					v5.fillRoundRect(v7 * f18.f29, v8 * f18.f29 + f18.f49,
							f18.f29 / 2, f18.f39, 0, 0);
					v5.fillRoundRect(v7 * f18.f29 + f18.f49, v8 * f18.f29,
							f18.f39, f18.f29 / 2, 0, 0);
					break;
				case GameObject.f1420:
					v5.setColor(Color.PINK);
					v5.fillRoundRect(v7 * f18.f29, v8 * f18.f29 + f18.f49,
							f18.f29, f18.f39 / 2, 0, 0);
					break;
				default:
					break;
				}
				v6 = f18.m109(v7, v8);
				if (v6 != null) {
					v6.m620(v5);
				}
				v8 = v8 + 1;
			}
			v7 = v7 + 1;
		}

        final int v10;
		v10 = f18.m29();
        int v11;
		v11 = 0;
		while (v11 < v10) {
			final Actor v12;
			v12 = f18.m119(v11);
			if (v12 != null) {
				v12.m620(v5);
			}
			v11 = v11 + 1;
		}

        // Debug
        otherif (f63.m513()) {
            v5.setColor(Color.RED);
            v5.drawString("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: " + f08.m320(), 750, 675);
            v5.drawString("positionY: " + f08.m420(), 750, 700);
        }

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

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

    /**
     * Player has won, move to the next level Called by logic()
     * 
     * @see StateGame#m23()
     */
    public void m28() {
        f58 = f58 + (f08.m115());

        m18(true);
    }

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

        if (f68 > 0) {
            m18(false);
        } else {
            if (f48 == 1) {
                f58 = f08.m115(); // win() never called, so
                                                  // score is the 1st level
                                                  // score
            }
            f63.m713(State.f13);
        }
    }

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

        switch (v13.getKeyCode()) {
            case KeyEvent.VK_UP:
                f08.m66(Direction.f07);
                break;
            case KeyEvent.VK_RIGHT:
                f08.m66(Direction.f17);
                break;
            case KeyEvent.VK_DOWN:
                f08.m66(Direction.f27);
                break;
            case KeyEvent.VK_LEFT:
                f08.m66(Direction.f37);
                break;
            case KeyEvent.VK_SPACE:
                f08.m66(Direction.f57);
                break;
            case KeyEvent.VK_P:
                // Don't interupt system pauses
                if (f88 < System.currentTimeMillis()) {
                    f78 = !f78;
                }
                break;
            case KeyEvent.VK_V:
                f63.m613();
                // AI debug
                f28.m00(f63.m513());
                break;
            case KeyEvent.VK_0:
                // game.changeState(STATE_MENU);
                break;
            default:
                break;
        }
    }
}

state/StateMenu.java


otherpackage pacman.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 f011;
    private int f111;
    private byte f211;
    private byte f311; // Corresponds to the index in mapList
    private String[] f411;

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

    @Override
    public void m13() {
        // Set cursor & menu position
        f011 = 380;
        f111 = 310;
        f211 = 0;
        f311 = 0;

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

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

        // Apply the filter
        f411 = v1.list(v2);

        if (f411 == null) {
            System.out.println("No maps exist!");
            f63.m713(f53);
            return;
        }
    }

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

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

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

        // Draw menu options
        v5.setFont(new Font("Comic Sans MS", Font.BOLD, 24));
        v5.drawString("Play Game", 380, 300);
        //g.drawString("Map Editor", 525, 340);
        v5.drawString("Scoreboard", 380, 340);
        v5.drawString("Exit", 380, 380);
        if (f411.length > 0) {
            v5.drawString("Current Map: " + f411[f311], 380, 600);
        } else {
            v5.drawString(
                    "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(f011, f111, 150, 5);
    }

    @Override
    public void keyPressed(KeyEvent v6) {
        switch (v6.getKeyCode()) {
            case KeyEvent.VK_RIGHT:
                if (f311 >= 0 && f311 < (f411.length - 1)) {
                    f311 = (byte) (f311 + 1);
                }
                break;
            case KeyEvent.VK_LEFT:
                if (f311 > 0 && f311 <= (f411.length - 1)) {
                    f311 = (byte) (f311 - 1);
                }
                break;
            case KeyEvent.VK_DOWN:
                if (f211 >= 0 && f211 < 2) {
                    f211 = (byte) (f211 + 1);
                    f111 = f111 + (38);
                }
                break;
            case KeyEvent.VK_UP:
                if (f211 > 0 && f211 <= 2) {
                    f211 = (byte) (f211 - 1);
                    f111 = f111 - (38);
                }
                break;
            case KeyEvent.VK_ENTER:
                // Execute the appropriate state change
                switch (f211) {
                    case 0:
                        // Play game
                        if (f411.length > 0) {
                            f63.m413(f411[f311]);
                            f63.m713(f23);
                        }
                        break;
                    case 1:
                        // Scoreboard
                        f63.m713(f13);
                        break;
                    case 2:
                        // Exit
                        f63.m713(f53);
                        break;
                    default:
                        break;
                }
                break;
            default:
                break;
        }
    }

}

state/StateScoreboard.java


otherpackage pacman.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[] f01;
    private int[] f11;
    private int f21;

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

    // Public Functions

    /**
     * Setup the scoreboard by loading the current score file
     * 
     * @see State#m13()
     */
    @Override
    public void m13() {
        // Only the top 10 scores will be displayed
        f01 = new String[10];
        f11 = new int[10];
        f21 = 0;

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

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

    /**
     * Render the Scoreboard and perform any updates
     */
    @Override
    public void m23() {
        final Graphics2D v1;
		v1 = f63.m213();

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

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

        int v2;
		v2 = 0;
		while (v2 < f01.length) {
			if (f01[v2] == null) {
				continue;
			}
			v1.drawString(f01[v2], 150, 210);
			v1.drawString(f11[v2] + " ", 960, 210);
			v2 = v2 + 1;
		}
    other}

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

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

            // Write the score file magic
            v4.writeUTF("RKPACSCORES");

            // Write # of scores in the file, then the actual scores
            v4.writeInt(f21);
            int v5;
			v5 = 0;
			while (v5 < f21) {
				if (f01[v5] == null) {
					break;
				}
				v4.writeUTF(f01[v5]);
				v4.writeInt(f11[v5]);
				v5 = v5 + 1;
			}

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

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

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

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

            // Read in scores
            f21 = v8.readInt();
            if (f21 > 10) {
                f21 = 10;
            }
            int v9;
			v9 = 0;
			while (v9 < f21) {
				f01[v9] = v8.readUTF();
				f11[v9] = v8.readInt();
				v9 = v9 + 1;
			}

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

    // 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.getKeyCode()) {
            case KeyEvent.VK_0:
                f63.m713(f03);
                break;
            default:
                break;
        }
    }

}

util/RequestedDirectionBuffer.java


otherpackage pacman.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 f02;
    private final LinkedList<Direction> f12;

    public RequestedDirectionBuffer(int v0) {
        super();
        this.f02 = v0;
        f12 = new LinkedList<Direction>();
        m22(Direction.f47);
    }

    /**
     * Get the currently requested direction.
     * 
     * @return the currently requested direction.
     */
    public Direction m02() {
        final Direction v1;
		v1 = f12.poll();
        f12.add(Direction.f47);
        return v1;
    }

    /**
     * Set the requested direction
     * 
     * @param v2
     *            the requested direction
     */
    public void m12(Direction v2) {
        m22(v2);
    }

    /**
     * Fill the queue with a direction
     * 
     * @param v3
     *            the direction.
     */
    private void m22(Direction v3) {
        f12.clear();
        int v4;
		v4 = 0;
		while (v4 < f02) {
			f12.add(v3);
			v4 = v4 + 1;
		}
    }
}