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 f09;

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

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

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

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

        f09 = false;

        // Movement
        f19 = v3;
        f29 = v4;
        f39 = Direction.f40;
        f49 = new RequestedDirectionBuffer(f59);
        f69 = 0;
        f79 = 0;
        f89 = 0;
        f99 = (float) (5d * f1910.f55);
    }

    // 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 m09() {
        return f19;
    }

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

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

    /**
     * Get dead status
     * 
     * @return True if dead, false if alive
     * @see Actor#m29(boolean)
     */
    public boolean m39() {
        return f09;
    }

    /**
     * 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 m49(float v6) {
        f99 = v6;
    }

    /**
     * Get the current speed of the actor
     * 
     * @return Current speed
     * @see Actor#m49(float)
     */
    public float m59() {
        return f99;
    }

    /**
     * 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 m69(Direction v7) {
        f49.m111(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#m195(Actor, int, int)
     */
    public boolean m79(int v8, int v9) {
        final boolean v10;
		v10 = f1910.m195(this, v8, v9);
        if (v10) {
            f1710 = v8;
            f1810 = 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#m510()
     * @see StateGame#m220()
     * @see AIManager#m27()
     */
    @Override
    public abstract void m510();

    /**
     * 
     * @see GameObject#m610(java.awt.Graphics2D)
     */
    @Override
    public abstract void m610(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 f017;
    private int f117;
    private boolean f217;

    // State
    private boolean f317;
    private boolean f417;
    private boolean f517;

    /**
     * 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.f410, v0, v1, v2, v3);
        f217 = true;
        f417 = false;
        f317 = v4;
        f517 = false;
    }

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

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

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

    /**
     * Set the current trapped status
     * 
     * @param v6
     *            Trye uf the ghost is in the spawn-jail
     */
    public void m317(boolean v6) {
        f317 = 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 m417() {
        return f217;
    }

    /**
     * Update the Path object for the ghost to follow'
     * 
     * @param v7
     *            Path object generated in process() by the AIManager
     * @see AIManager#m27()
     */
    public void m517(Path v7) {
        f117 = 1;
        f017 = v7;
        f217 = 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 m617(boolean v8) {
        f517 = 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#m510()
     */
    @Override
    public void m510() {
        // Move to the next step
        if (f017 != null && f117 < f017.m013()) {

            // Figure out the direction
            if ((f017.m313(f117) - f1810) < 0) {
                f39 = Direction.f00;
            } else if ((f017.m313(f117) - f1810) > 0) {
                f39 = Direction.f20;
            } else if ((f017.m213(f117) - f1710) > 0) {
                f39 = Direction.f10;
            } else {
                f39 = Direction.f30;
            }

            // 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 (f39) {
                case f00:
                    f79 = 0;
                    f89 -= 0 - f99;
                    // 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(f89) >= f1910.f25) {
                        f89 = 0;
                        m79(f1710, f1810 - 1);
                        f117++;
                    }
                    break;
                case f10:
                    f79 += 0 + f99;
                    f89 = 0;
                    if (Math.abs(f79) >= f1910.f25) {
                        f79 = 0;
                        m79(f1710 + 1, f1810);
                        f117++;
                    }
                    break;
                case f20:
                    f79 = 0;
                    f89 += 0 + f99;
                    if (Math.abs(f89) >= f1910.f25) {
                        f89 = 0;
                        m79(f1710, f1810 + 1);
                        f117++;
                    }
                    break;
                case f30:
                    f79 -= 0 - f99;
                    f89 = 0;
                    if (Math.abs(f79) >= f1910.f25) {
                        f79 = 0;
                        m79(f1710 - 1, f1810);
                        f117++;
                    }
                    break;
                case f50:
                case f40:
                    // do not move
            }
        } else {
            f217 = true;
        }
    }

    /**
     * Draw the ghost
     * 
     * @see GameObject#m610(Graphics2D)
     */
    @Override
    public void m610(Graphics2D v9) {
        final int v10;
		v10 = (int) ((f1910.f25 * f1710) + f79);
        final int v11;
		v11 = (int) ((f1910.f25 * f1810) + f89);

        v9.setColor(f1610);

        // Body
        if (f417) {
            v9.setColor(Color.WHITE);
        }
        v9.fillArc(v10, v11, f1910.f25, f1910.f25, 0, 360);
        v9.fillRect((int) ((f1910.f25 * f1710) + f79), (int) ((f1910.f25 * f1810)
                + (f1910.f25 / 2) + f89), f1910.f25, f1910.f25 / 2);

        // Eyes
        if (f417) {
            v9.setColor(Color.BLACK);
        } else {
            v9.setColor(Color.WHITE);
        }
        v9.fillOval((int) ((f1910.f25 * f1710) + 4 + f79),
                (int) ((f1910.f25 * f1810) + 3 + f89), 8, 10);
        v9.fillOval((int) ((f1910.f25 * f1710) + 12 + f79),
                (int) ((f1910.f25 * f1810) + 3 + f89), 8, 10);

        // Eyeballs
        v9.setColor(Color.BLUE);
        v9.fillOval((int) ((f1910.f25 * f1710) + 7 + f79),
                (int) ((f1910.f25 * f1810) + 6 + f89), 4, 4);
        v9.fillOval((int) ((f1910.f25 * f1710) + 13 + f79),
                (int) ((f1910.f25 * f1810) + 6 + f89), 4, 4);

        // Debug draw path
        if (f517 && f017 != null) {
            int v12;
			v12 = 0;
			while (v12 < f017.m013()) {
				final Path.Step otherv13;
				v13 = f017.m113(v12);
				v9.setColor(f1610);
				v9.drawLine(f1910.f25 * v13.m013(), f1910.f25 * v13.m113(),
						(f1910.f25 * v13.m013()) + f1910.f25,
						(f1910.f25 * v13.m113()) + f1910.f25);
				v12++;
			}
        }
    }
}

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(f310, 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 += 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 m510() {
        final Actor v5;
		v5 = f1910.m135(f1710, f1810, true);
        if (v5 != null && v5.m010() == GameObject.f410) {
            // Notify the State of the loss if pacman isn't powered up
            if (!f115) {
                m29(true);
                return;
            } else {
                v5.m29(true);
            }
        }

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

        boolean v6;
		v6 = false;
        final Item v7;
		v7 = f1910.m105(f1710, f1810);
        if (v7 != null) {
            v6 = v7.m36(this);
        }

        // Update the item's state in the map (remove if itemDestroy is true)
        if (v6) {
            f1910.m155(f1710, f1810);
        }

        final Direction v8;
		v8 = f49.m011();
        if (v8 != Direction.f40) {
            if (f1910.m205(this, v8)) {
                f39 = 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 (f39) {
            case f00:
                // Move in the direction only if the next map cell in this
                // direction is reachable (not occupied by a wall)
                if (f1910.m195(this, f1710, f1810 - 1)) {
                    f79 = 0;
                    f89 -= 0 - f99;
                    // 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(f89) >= f1910.f25) {
                        f89 = 0;
                        m79(f1710, f1810 - 1);
                    }
                }
                f69 = 90;
                break;
            case f10:
                if (f1910.m195(this, f1710 + 1, f1810)) {
                    f79 += 0 + f99;
                    f89 = 0;
                    if (Math.abs(f79) >= f1910.f25) {
                        f79 = 0;
                        m79(f1710 + 1, f1810);
                    }
                }
                f69 = 0;
                break;
            case f20:
                if (f1910.m195(this, f1710, f1810 + 1)) {
                    f79 = 0;
                    f89 += 0 + f99;
                    if (Math.abs(f89) >= f1910.f25) {
                        f89 = 0;
                        m79(f1710, f1810 + 1);
                    }
                }
                f69 = -90;
                break;
            case f30:
                if (f1910.m195(this, f1710 - 1, f1810)) {
                    f79 -= 0 - f99;
                    f89 = 0;
                    if (Math.abs(f79) >= f1910.f25) {
                        f79 = 0;
                        m79(f1710 - 1, f1810);
                    }
                }
                f69 = 180;
                break;
            case f50:
            case f40:
                // do not move
        }
    }

    /**
     * Draw & animate pacman
     * 
     * @param v9
     *            The graphics context
     * @see Actor#m510()
     */
    @Override
    public void m610(Graphics2D v9) {
        final int v10;
		v10 = (int) ((f1910.f25 * f1710) + f79);
        final int v11;
		v11 = (int) ((f1910.f25 * f1810) + f89);

        v9.setColor(f1610);

        // 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(f79) >= f1910.f25 / 2) || Math.abs(f89) >= f1910.f25 / 2) {
            v9.fillArc(v10, v11, f1910.f25, f1910.f25, 0 + f69, 360); // flap
                                                                                           // closed
        } else {
            v9.fillArc(v10, v11, f1910.f25, f1910.f25, 35 + f69, 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 f07;
    private Player f17;

    // Logic
    private boolean f27;
    private PathFinder f37;
    private final ArrayList<Ghost> f47;
    private long f57;

    /**
     * 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
        f47 = new ArrayList<Ghost>();
        m17(v0, v1);
        f57 = System.currentTimeMillis() + 10000;
        f27 = v2;
    }

    // Getters and Setters

    /**
     * Direct ghosts to display diagnostic information
     * 
     * @param v3
     *            If true, ghosts will enter debug mode
     * @see Ghost#setDebugDrawPath
     */
    public void m07(boolean v3) {
        f27 = 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 m17(Map v4, Player v5) {
        f47.clear();
        f07 = v4;
        f17 = v5;
        f37 = new PathFinder(v4, 500, false);

        final int v6;
		v6 = f07.m25();
        int v7;
		v7 = 0;
		while (v7 < v6) {
			final Actor v8;
			v8 = f07.m115(v7);
			if (v8.m010() == GameObject.f410) {
				f47.add((Ghost) v8);
			}
			v7++;
		}
    other}

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

        boolean v9;
		v9 = false;
        if (f07.m125().m215()) {
            v9 = true;
        }

        // Release the next ghost
        if (System.currentTimeMillis() > f57) {
            for (final Ghost v10 : f47) {
                if (v10.m217()) {
                    v10.m317(false);
                    v10.m79(13, 11);
                    f57 = System.currentTimeMillis() + 8000;
                    break;
                }
            }
        }

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

                // Clear path and move to jail
                v11.otherm517(null);
                v11.m79(v12, v13);
                v11.m317(true);
                v11.m29(false);
            }

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

            // Develop path for ghost
            if (!v11.m217() && v11.m417()) {
                int v15;
				v15 = f17.m310();
                int v16;
				v16 = f17.m410();
                // 45% chance of randomizing a destination, or if they are
                // fearful
                if (v9 || Math.random() < 0.45) {
                    v15 = (int) (Math.random() * f07.m05());
                    v16 = (int) (Math.random() * f07.m15());
                }
                final Path v17;
				v17 = f37.m08(v11, v11.m310(), v11.m410(), v15, v16);
                v11.m517(v17);
            }

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

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

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 m016(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 f018 = 1L;
    private final StateEditor f118;
    private JMenuItem f218;
    private JTextArea f318;
    private JTextField f418;
    private JLabel f518;
    private JLabel f618;
    private JLabel f718;
    private JButton f818;
    private JButton f918;
    private JTextField f1018;
    private JButton f1118;
    private JButton f1218;
    private JComboBox f1318;
    private JButton f1418;
    private JComboBox f1518;
    private JCheckBox f1618;
    private JLabel f1718;
    private JButton f1818;
    private JLabel f1918;
    private JMenuItem f2018;
    private JSeparator f2118;
    private JMenuItem f2218;
    private JMenuItem f2318;
    private JMenu f2418;
    private JMenuBar f2518;
    private JLabel f2618;
    private JSeparator f2718;
    private JButton f2818;
    private JButton f2918;
    private JButton f3018;

    public EditorFrame(StateEditor v0) {
        super();
        f118 = v0;
        m018();
    }

    private void m018() {
        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) {
                    f118.m020().m73(State.f520);
                }
            });
            {
                f2518 = new JMenuBar();
                setJMenuBar(f2518);
                {
                    f2418 = new JMenu();
                    f2518.add(f2418);
                    f2418.setText("File");
                    {
                        f2318 = new JMenuItem();
                        f2418.add(f2318);
                        f2318.setText("Load");
                    }
                    {
                        f2218 = new JMenuItem();
                        f2418.add(f2218);
                        f2218.setText("Save");
                    }
                    {
                        f218 = new JMenuItem();
                        f2418.add(f218);
                        f218.setText("Save As..");
                    }
                    {
                        f2118 = new JSeparator();
                        f2418.add(f2118);
                    }
                    {
                        f2018 = new JMenuItem();
                        f2418.add(f2018);
                        f2018.setText("Exit");
                    }
                }
            }
            {
                f3018 = new JButton();
                getContentPane().add(f3018);
                f3018.setText("Wall");
                f3018.setBounds(12, 218, 59, 23);
                f3018.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v2) {
                        f118.m012(GameObject.f610);
                    }
                });
            }
            {
                f2918 = new JButton();
                getContentPane().add(f2918);
                f2918.setText("Dot");
                f2918.setBounds(12, 36, 59, 23);
                f2918.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v3) {
                        f118.m012(GameObject.f010);
                    }
                });
            }
            {
                f2818 = new JButton();
                getContentPane().add(f2818);
                f2818.setText("Pacman");
                f2818.setBounds(136, 36, 110, 23);
                f2818.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v4) {
                        f118.m012(GameObject.f310);
                    }
                });
            }
            {
                f2718 = new JSeparator();
                getContentPane().add(f2718);
                f2718.setBounds(12, 301, 360, 10);
            }
            {
                f2618 = new JLabel();
                getContentPane().add(f2618);
                f2618.setText("Placeable Objects");
                f2618.setBounds(12, 12, 129, 16);
            }
            {
                f1918 = new JLabel();
                getContentPane().add(f1918);
                f1918.setText("Wall Type");
                f1918.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" });
                f1318 = new JComboBox();
                getContentPane().add(f1318);
                f1318.setModel(v5);
                f1318.setBounds(12, 246, 153, 23);
                f1318.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v6) {
                        final String v7;
						v7 = (String) f1318.getSelectedItem();
                        if (v7.equals("Vertical")) {
                            f118.m112(GameObject.f810);
                        } else if (v7.equals("Horizontal")) {
                            f118.m112(GameObject.f910);
                        } else if (v7.equals("Top Left")) {
                            f118.m112(GameObject.f1010);
                        } else if (v7.equals("Top Right")) {
                            f118.m112(GameObject.f1110);
                        } else if (v7.equals("Bottom Left")) {
                            f118.m112(GameObject.f1210);
                        } else if (v7.equals("Bottom Right")) {
                            f118.m112(GameObject.f1310);
                        } else if (v7.equals("Ghost Barrier")) {
                            f118.m112(GameObject.f1410);
                        } else {
                            f118.m112(GameObject.f910);
                        }
                    }
                });
            }
            {
                f1218 = new JButton();
                getContentPane().add(f1218);
                f1218.setText("Save");
                f1218.setBounds(12, 317, 70, 23);
                f1218.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v8) {
                        f118.m712(f1018.getText());
                    }
                });
            }
            {
                f1118 = new JButton();
                getContentPane().add(f1118);
                f1118.setText("Load");
                f1118.setBounds(87, 317, 68, 23);
                f1118.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v9) {
                        f118.m812(f1018.getText());
                    }
                });
            }
            {
                f1018 = new JTextField();
                getContentPane().add(f1018);
                f1018.setBounds(12, 345, 225, 23);
                f1018.setText("test.map");
            }
            {
                f918 = new JButton();
                getContentPane().add(f918);
                f918.setText("New");
                f918.setBounds(160, 317, 71, 23);
                f918.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v10) {
                        f118.m612(28, 31);
                    }
                });
            }
            {
                f818 = new JButton();
                getContentPane().add(f818);
                f818.setText("Teleport");
                f818.setBounds(237, 218, 110, 23);
                f818.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v11) {
                        f118.m012(GameObject.f710);
                        f118.m512(Integer.parseInt(f418.getText()),
                                Integer.parseInt(f318.getText()));
                    }
                });
            }
            {
                f718 = new JLabel();
                getContentPane().add(f718);
                f718.setText("Teleport Settings");
                f718.setBounds(237, 196, 123, 16);
            }
            {
                f618 = new JLabel();
                getContentPane().add(f618);
                f618.setText("Dest X:");
                f618.setBounds(237, 249, 60, 16);
            }
            {
                f518 = new JLabel();
                getContentPane().add(f518);
                f518.setText("Dest Y: ");
                f518.setBounds(235, 279, 52, 16);
            }
            {
                f418 = new JTextField();
                getContentPane().add(f418);
                f418.setText("13");
                f418.setBounds(280, 246, 85, 23);
            }
            {
                f318 = new JTextArea();
                getContentPane().add(f318);
                f318.setText("17");
                f318.setBounds(280, 275, 82, 20);
            }
            {
                f1818 = new JButton();
                getContentPane().add(f1818);
                f1818.setText("Powerup");
                f1818.setBounds(12, 65, 102, 23);
                f1818.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v12) {
                        f118.m012(GameObject.f110);
                    }
                });
            }
            {
                f1718 = new JLabel();
                getContentPane().add(f1718);
                f1718.setText("Ghost Settings");
                f1718.setBounds(272, 12, 76, 16);
            }
            {
                f1618 = new JCheckBox();
                getContentPane().add(f1618);
                f1618.setText("Trapped");
                f1618.setBounds(360, 10, 100, 20);
                f1618.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v13) {
                        f118.m312(!f118.m412());
                        System.out.println(f118.m412());
                    }
                });
            }
            {
                final ComboBoxModel v14;
				v14 = new DefaultComboBoxModel(new String[] {
						"Blinky", "Pinky", "Inky", "Clyde" });
                f1518 = new JComboBox();
                getContentPane().add(f1518);
                f1518.setModel(v14);
                f1518.setBounds(272, 65, 146, 23);
                f1518.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent v15) {
                        final String v16;
						v16 = (String) f1518.getSelectedItem();
                        f118.m212(v16);
                    }
                });
            }
            {
                f1418 = new JButton();
                getContentPane().add(f1418);
                f1418.setText("Add Ghost");
                f1418.setBounds(272, 36, 146, 23);
                f1418.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent v17) {
                        f118.m012(GameObject.f410);
                    }
                });
            }
            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.f510, 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 (f1710 + v4 < 0 || f1810 + v5 < 0 || f1710 + v4 >= f1910.m05()
                || f1810 + v5 >= f1910.m15()) {
            return;
        }

        f1710 += v4;
        f1810 += v5;
    }

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

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

        v6.setColor(f1610);

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

}

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 f03 = 1L;

    // Debug vars
    private boolean f13;

    // Threading
    private boolean f23;

    // Graphics variables
    private Frame f33;
    public final int f43;
    public final int f53;
    private BufferStrategy f63;

    // State
    private int f73;
    private State f83;
    private boolean f93;
    private int f103;
    private String f113;

    /**
     * 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#m03()
     */
    public Game(int v0, int v1) {
        // Set resolution settings
        f43 = v0;
        f53 = v1;

        // Init game
        m03();
    }

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

        f113 = "test.map";
        f93 = false;

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

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

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

        f23 = true;
    }

    // Getter and Setter methods

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

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

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

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

    /**
     * Return the current debug setting
     * 
     * @return True if debug setting is on
     * @see Game#m63()
     */
    public boolean m53() {
        return f13;
    }

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

    // Public Methods

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

    /**
     * The main game loop that handles graphics and game state determination
     */
    public void m83() {
    	final long v5;
		v5 = 20;
    	long v6;
		v6 = 0;
    	
        for (; f23;) {
			otherif ((v6 + v5) > System.currentTimeMillis()) {
				continue;
			}
			v6 = System.currentTimeMillis();
			if (f93) {
				f93 = false;
				m93(f103);
				continue;
			}
			final Graphics2D v7;
			v7 = m23();
			v7.setColor(Color.black);
			v7.fillRect(0, 0, f43, f53);
			f83.m220();
			v7.dispose();
			f63.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#m73(int)
     * @see Game#m83()
     */
    private void m93(int v9) {
        // Cleanup for the outgoing state
        if (f83 != null) {
            f33.removeKeyListener(f83);
            removeKeyListener(f83);
            f83.m320();
        }

        // Set the new state type
        f73 = v9;

        // Instance the new state (reset() is called in the construtor)
        switch (f73) {
            case State.f220:
                f83 = new StateGame(this);
                break;
            case State.f120:
                f83 = 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.f420:
                f83 = new StateEditor(this);
                break;
            case State.f020:
                f83 = new StateMenu(this);
                break;
            case State.f520:
                f83 = null;
                f23 = false;
                break;
            default:
                break;
        }

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

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 f010 = 1;
    public static final int f110 = 2;
    public static final int f210 = 4;
    public static final int f310 = 8;
    public static final int f410 = 16;
    public static final int f510 = 32; // Virtual
    public static final int f610 = 64; // Virtual
    public static final int f710 = 128;

    // Wall types (Walls aren't instanced GameObject's)
    public static final byte f810 = 1;
    public static final byte f910 = 2;
    public static final byte f1010 = 3;
    public static final byte f1110 = 4;
    public static final byte f1210 = 5;
    public static final byte f1310 = 6;
    public static final byte f1410 = 7;

    // Generic object attributes
    protected int f1510;
    protected Color f1610;
    protected int f1710;
    protected int f1810;

    // Outside refereneces
    protected final Map f1910; // 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 m010() {
        return f1510;
    }

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

    /**
     * Set the current base color used when rendering the object
     * 
     * @param v0
     *            java.awt.Color Color of object
     */
    public void m210(Color v0) {
        f1610 = 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#m79(int, int)
     */
    public int m310() {
        return f1710;
    }

    /**
     * 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#m79(int, int)
     */
    public int m410() {
        return f1810;
    }

    // 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) {
        f1510 = v1;
        f1610 = v2;
        f1910 = v3;
        f1710 = v4;
        f1810 = v5;
    }

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

    /**
     * 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#m220()
     */
    public abstract void m610(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 f06;
    private int f16;

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

        f06 = 13;
        f16 = 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 m06(int v5, int v6) {
        f06 = v5;
        f16 = v6;
    }

    /**
     * Retrieve the teleport destination X coordinate
     * 
     * @return X destination coordinate
     * @see Item#m06(int, int)
     */
    public int m16() {
        return f06;
    }

    /**
     * Retrieve the teleport destination Y coordinate
     * 
     * @return Y destination coordinate
     * @see Item#m06(int, int)
     */
    public int m26() {
        return f16;
    }

    /**
     * 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#m510()
     */
    public boolean m36(Player v7) {
        boolean v8;
		v8 = false;

        // Perform action based on type
        switch (f1510) {
            case f010:
                v7.m015(10);
                v8 = true;
                break;
            case f110:
                v7.m015(50);
                v7.m315(true);
                v8 = true;
                break;
            case f710:
                v7.m79(f06, f16);
                break;
            default:
                break;
        }

        return v8;
    }

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

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

        final int v10;
		v10 = (f1710 * f1910.f25) + f1910.f25 / 2;
        final int v11;
		v11 = (f1810 * f1910.f25) + f1910.f25 / 2;

        // Render item based on type
        switch (f1510) {
            case f010:
                v9.fillArc(v10 - 4, v11 - 4, 8, 8, 0, 360);
                break;
            case f110:
                v9.fillArc(v10 - 8, v11 - 8, 16, 16, 0, 360);
                break;
            case f710:
                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.m73(State.f020);
        v1.m83();
        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 f05;
    private int f15;
    public final int f25;
    public final int f35;
    public final int f45;
    public final double f55;

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

    /**
     * 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
        f05 = v0;
        f15 = v1;
        f55 = v2;
        f25 = (int) (32 * v2);
        f35 = (int) (12 * v2);
        f45 = (int) (10 * v2);
        f95 = 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
        f65 = new byte[f05][f15];

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

        // Create m_objects, an arraylist with all actorList
        f85 = 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
        f55 = v4;
        f25 = (int) (32 * v4);
        f35 = (int) (12 * v4);
        f45 = (int) (10 * v4);

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

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

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

    /**
     * Get the number of actorList on the map (the size of the actorList
     * ArrayList)
     * 
     * @return Number of actorList
     */
    public int m25() {
        return f85.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[][] m35() {
        return f65;
    }

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

    /**
     * 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 m55() {
        return f95;
    }

    /**
     * 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 m65(int v5, int v6, byte v7) {
        // Check bounds
        if (v5 < 0 || v6 < 0 || v5 >= f05 || v6 >= f15) {
            return false;
        }

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

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

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

        final int v9;
		v9 = v8.m310();
        final int v10;
		v10 = v8.m410();
        if (v9 < 0 || v10 < 0 || v9 >= f05 || v10 >= f15) {
            return false;
        }

        // Add to the itemMap
        if (v8.m010() == GameObject.f010) {
            f95++;
        }
        f75[v9][v10] = v8;
        return true;
    }

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

        final int v12;
		v12 = v11.m310();
        final int v13;
		v13 = v11.m410();
        if (v12 < 0 || v13 < 0 || v12 >= f05 || v13 >= f15) {
            return false;
        }

        // Add to the array list
        f85.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 m95(int v14, int v15) {
        // Check bounds
        if (v14 < 0 || v15 < 0 || v14 >= f05 || v15 >= f15) {
            return -1;
        }

        return f65[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 m105(int v16, int v17) {
        // Check bounds
        if (v16 < 0 || v17 < 0 || v16 >= f05 || v17 >= f15) {
            return null;
        }

        return f75[v16][v17];
    }

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

    /**
     * Find and return the player object within the local actorList ArrayList
     * 
     * @return The player object. null if not found
     */
    public Player m125() {
        // Get from the object map
        for (final Actor v21 : f85) {
            if (v21.m010() == GameObject.f310) {
                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 m135(int v22, int v23, boolean v24) {
        // Check bounds
        if (v22 < 0 || v23 < 0 || v22 >= f05 || v23 >= f15) {
            return null;
        }

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

            if (v25.m310() == v22 && v25.m410() == 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 m145(int v26) {
        f85.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 m155(int v27, int v28) {
        // Check bounds
        if (v27 < 0 || v28 < 0 || v27 >= f05 || v28 >= f15) {
            return;
        }

        if (f75[v27][v28].m010() == GameObject.f010) {
            f95--;
        }

        f75[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 m165(int v29, int v30) {
        boolean v31;
		v31 = false;

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

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

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

        int v32;
		v32 = 0;
		while (v32 < f85.size()) {
			Actor otherv33;
			v33 = f85.get(v32);
			if (v33.m310() == v29 && v33.m410() == v30) {
				f85.remove(v32);
				v33 = null;
				v32--;
				v31 = true;
			}
			v32++;
		}

        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 m175(GameObject v34, GameObject v35) {
        return (int) Math.sqrt(Math.pow(Math.abs(v34.m310() - v35.m310()), 2)
                + Math.pow(Math.abs(v34.m410() - v35.m410()), 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 m185(int v36, int v37) {
        // Check bounds
        if (v36 < 0 || v37 < 0 || v36 >= f05 || v37 >= f15) {
            return false;
        }

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

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

        // Actor collission
        if (m135(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 m195(Actor v38, int v39, int v40) {
        if (v38 == null) {
            return false;
        }

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

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

        // Allow the Actor to move
        return true;
    }

    public boolean m205(Actor v41, Direction v42) {
        int v43;
		v43 = v41.m310();
        int v44;
		v44 = v41.m410();
        switch (v42) {
            case f00:
                v44--;
                break;
            case f10:
                v43++;
                break;
            case f20:
                v44++;
                break;
            case f30:
                v43--;
                break;
            case f40:
                return true;
        }

        return m195(v41, v43, v44);
    }

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

    /**
     * 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 m225(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 m235(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(f05);
            v54.writeInt(f15);

            int v55;
			v55 = 0;
			while (v55 < f05) {
				int v56;
				v56 = 0;
				while (v56 < f15) {
					v54.write(f65[v55][v56]);
					v56++;
				}
				v55++;
			}

            Item v57;
			v57 = null;
            int v58;
			v58 = 0;
			while (v58 < f05) {
				int v59;
				v59 = 0;
				while (v59 < f15) {
					v57 other= f75[v58][v59];
					if (v57 == null) {
						v54.writeBoolean(false);
						continue;
					}
					v54.writeBoolean(true);
					v54.writeInt(v57.m010());
					v54.writeInt(v57.m310());
					v54.writeInt(v57.m410());
					v54.writeInt(v57.m110().getRGB());
					if (v57.m010() == GameObject.f710) {
						v54.writeInt(v57.m16());
						v54.writeInt(v57.m26());
					}
					v59++;
				}
				v58++;
			}

            // Write the number of actorList, then all actor data
            v54.otherwriteInt(f85.size());
            for (final Actor v60 : f85) {
                v54.writeInt(v60.m010());
                v54.writeInt(v60.m310());
                v54.writeInt(v60.m410());
                v54.writeInt(v60.m110().getRGB());
                if (v60.m010() == GameObject.f410) {
                    v54.writeBoolean(((Ghost) v60).m217());
                }
            }

            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 m245(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
            f05 = v64.readInt();
            f15 = v64.readInt();
            f95 = 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
            f65 = new byte[f05][f15];

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

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

            int v65;
			v65 = 0;
			while (v65 < f05) {
				int v66;
				v66 = 0;
				while (v66 < f15) {
					m65(v65, v66, v64.readByte());
					v66++;
				}
				v65++;
			}

            int v67;
			v67 = 0;
			while (v67 < f05) {
				int v68;
				v68 = 0;
				while (v68 < f15) {
					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());
					m75(new Item(v69, v72, this, v70, v71));
					if (v69 == GameObject.f710) {
						final int v73;
						v73 = v64.readInt();
						final int v74;
						v74 = v64.readInt();
						f75[v70][v71].m06(v73, v74);
					}
					v68++;
				}
				v67++;
			}

            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.f310) {
					m85(new Player(this, v78, v79));
				} else if (v77 == GameObject.f410) {
					final boolean v81;
					v81 = v64.readBoolean();
					m85(new Ghost(v80, this, v78, v79, v81));
				}
				v76++;
			}

            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> f013;

    /**
     * Create an empty path
     */
    public Path() {
        f013 = 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 m013() {
        return f013.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 m113(int v0) {
        return f013.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 m213(int v1) {
        return m113(v1).f013;
    }

    /**
     * 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 m313(int v2) {
        return m113(v2).f113;
    }

    /**
     * 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 m413(int v3, int v4) {
        f013.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 m513(int v5, int v6) {
        f013.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 m613(int v7, int v8) {
        return f013.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 f013;
        /** The y coordinate at the given step */
        private final int f113;

        /**
         * 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.f013 = v9;
            this.f113 = v10;
        }

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

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

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

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

                return (v12.f013 == f013) && (v12.f113 == f113);
            }

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

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

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

    /**
     * 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.f68 = v6;
        this.f28 = v3;
        this.f38 = v4;
        this.f58 = v5;

        f08 = new ArrayList<Node>();
        f48 = new Node[v3.m05()][v3.m15()];

        int v7;
		v7 = 0;
		while (v7 < v3.m05()) {
			int v8;
			v8 = 0;
			while (v8 < v3.m15()) {
				f48[v7][v8] = new Node(v7, v8);
				v8++;
			}
			v7++;
		}
    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 m08(Actor v9, int v10, int v11, int v12, int v13) {
        // easy first check, if the destination is blocked, we can't get there

        if (!f28.m195(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
        f48[v10][v11].f28 = 0;
        f48[v10][v11].f58 = 0;
        f08.clear();
        f18.m18();
        f18.m28(f48[v10][v11]);

        f48[v12][v13].f38 = null;

        int v14;
		v14 = 0;
        for (; (v14 < f38) && (f18.otherm48() != 0);) {
			final Node v15;
			v15 = m18();
			if (v15 == f48[v12][v13]) {
				break;
			}
			m48(v15);
			m58(v15);
			int v16;
			v16 = -1;
			while (v16 < 2) {
				int v17;
				v17 = -1;
				while (v17 < 2) {
					otherif ((v16 == 0) && (v17 == 0)) {
						continue;
					}
					if (!f58) {
						if ((v16 != 0) && (v17 != 0)) {
							continue;
						}
					}
					final int v18;
					v18 = v16 + v15.f08;
					final int v19;
					v19 = v17 + v15.f18;
					if (m88(v9, v10, v11, v18, v19)) {
						final float v20;
						v20 = v15.f28 + m98(v9, v15.f08, v15.f18, v18, v19);
						final Node v21;
						v21 = f48[v18][v19];
						if (v20 < v21.f28) {
							if (m38(v21)) {
								m48(v21);
							}
							if (m68(v21)) {
								m78(v21);
							}
						}
						if (!m38(v21) && !(m68(v21))) {
							v21.f28 = v20;
							v21.f48 = m108(v9, v18, v19, v12, v13);
							v14 = Math.max(v14, v21.m08(v15));
							m28(v21);
						}
					}
					v17++;
				}
				v16++;
			}
		}

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

        if (f48[v12][v13].f38 == 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 = f48[v12][v13];
        for (; v23 != f48[v10][v11];) {
			v22.m513(v23.f08, v23.f18);
			v23 = v23.f38;
		}
        v22.otherm513(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 m18() {
        return (Node) f18.m08();
    }

    /**
     * Add a node to the open list
     * 
     * @param v24
     *            The node to be added to the open list
     */
    protected void m28(Node v24) {
        f18.m28(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 m38(Node v25) {
        return f18.m58(v25);
    }

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

    /**
     * Add a node to the closed list
     * 
     * @param v27
     *            The node to add to the closed list
     */
    protected void m58(Node v27) {
        f08.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 m68(Node v28) {
        return f08.contains(v28);
    }

    /**
     * Remove a node from the closed list
     * 
     * @param v29
     *            The node to remove from the closed list
     */
    protected void m78(Node v29) {
        f08.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 m88(Actor v30, int v31, int v32, int v33, int v34) {
        boolean v35;
		v35 = (v33 < 0) || (v34 < 0) || (v33 >= f28.m05())
				|| (v34 >= f28.m15());

        if ((!v35) && ((v31 != v33) || (v32 != v34))) {
            v35 = f28.m195(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 m98(Actor v36, int v37, int v38, int v39, int v40) {
        return f28.m225(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 m108(Actor v41, int v42, int v43, int v44, int v45) {
        return f68.m016(f28, v41, v42, v43, v44, v45);
    }

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

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

        /**
         * Empty the list
         */
        public void m18() {
            f08.clear();
        }

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

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

        /**
         * Get the number of elements in the list
         * 
         * @return The number of element in the list
         */
        public int m48() {
            return f08.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 m58(Object v48) {
            return f08.contains(v48);
        }
    }

    /**
     * A single node in the search graph
     */
    private class Node implements Comparable<Object> {
        /** The x coordinate of the node */
        private final int f08;
        /** The y coordinate of the node */
        private final int f18;
        /** The path cost for this node */
        private float f28;
        /** The parent of this node, how we reached it in the search */
        private Node f38;
        /** The heuristic cost of this node */
        private float f48;
        /** The search depth of this node */
        private int f58;

        /**
         * 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.f08 = v49;
            this.f18 = 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 m08(Node v51) {
            f58 = v51.f58 + 1;
            this.f38 = v51;

            return f58;
        }

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

            final float v54;
			v54 = f48 + f28;
            final float v55;
			v55 = v53.f48 + v53.f28;

            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 f020 = 1;
    public static final int f120 = 2;
    public static final int f220 = 4;
    public static final int f320 = 8;
    // public static final int STATE_GAMEOVER = 16;
    public static final int f420 = 32;
    public static final int f520 = 64;

    protected Game f620;

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

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

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

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

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

    /*
     * Human Input default
     */

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

    @Override
    public void keyTyped(KeyEvent v2) {
        // Esc
        switch (v2.getKeyChar()) {
            case 27:
                f620.m73(f520);
                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 f012;
    private EditorMarker f112;
    private boolean f212;
    private Map f312;

    // Placement variables
    private int f412;
    private byte f512;
    private String f612;
    private boolean f712;
    private int f812;
    private int f912;

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

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

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

        // Create the editor toolpane
        f620.m13().setSize(1024, f620.f53);
        f012 = new EditorFrame(this);
        f012.setVisible(true);

        // Defaults
        f412 = GameObject.f610;
        f512 = GameObject.f810;
        f612 = "Blinky";
        f712 = false;
        f812 = 13;
        f912 = 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 m012(int v1) {
        f412 = 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 m112(byte v2) {
        f512 = 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 m212(String v3) {
        f612 = v3;
    }

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

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

    /**
     * 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 m512(int v5, int v6) {
        f812 = v5;
        f912 = v6;
    }

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

        f412 = GameObject.f010;
    }

    /**
     * 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 m612(int v7, int v8) {
        // Setup the game map
        f620.m23().setBackground(Color.BLACK);
        f1012 = v7;
        f1112 = v8;
        f312 = new Map(28, 31, 32);

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

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

    /**
     * Setup and render a map loaded from the file system
     * 
     * @param v10
     */
    public void m812(String v10) {
        // Setup the game map
        f620.m23().setBackground(Color.BLACK);
        f312 = new Map(System.getProperty("user.dir") + "\\" + v10, 32);
        f1012 = f312.m05();
        f1112 = f312.m15();

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

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

        final Graphics2D v11;
		v11 = f620.m23();

        // 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 < f1012) {
			int v14;
			v14 = 0;
			while (v14 < f1112) {
				final byte otherv15;
				v15 = f312.m95(v13, v14);
				v11.setColor(Color.BLUE);
				switch (v15) {
				case 0:
					break;
				case GameObject.f810:
					v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
							f312.f25, 0, 0);
					break;
				case GameObject.f910:
					v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
							f312.f25, 12, 0, 0);
					break;
				case GameObject.f1010:
					v11.fillRoundRect(v13 * f312.f25 + (f312.f25 / 2), v14
							* f312.f25 + 10, f312.f25 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25
							+ (f312.f25 / 2), 12, f312.f25 / 2, 0, 0);
					break;
				case GameObject.f1110:
					v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
							f312.f25 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25
							+ (f312.f25 / 2), 12, f312.f25 / 2, 0, 0);
					break;
				case GameObject.f1210:
					v11.fillRoundRect(v13 * f312.f25 + (f312.f25 / 2), v14
							* f312.f25 + 10, f312.f25 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
							f312.f25 / 2, 0, 0);
					break;
				case GameObject.f1310:
					v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
							f312.f25 / 2, 12, 0, 0);
					v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
							f312.f25 / 2, 0, 0);
					break;
				case GameObject.f1410:
					v11.setColor(Color.PINK);
					v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
							f312.f25, 6, 0, 0);
					break;
				default:
					break;
				}
				v12 = f312.m105(v13, v14);
				if (v12 != null) {
					v12.m610(v11);
				}
				v14++;
			}
			v13++;
		}

        final int v16;
		v16 = f312.m25();
        int v17;
		v17 = 0;
		while (v17 < v16) {
			final Actor v18;
			v18 = f312.m115(v17);
			if (v18 != null) {
				v18.m610(v11);
			}
			v17++;
		}

        // Paint the marker
        f112.m610(v11);

        // Paint gridline overlay if in editor view
        if (!f212) {
            v11.setColor(Color.RED);
            int v19;
			v19 = 0;
			while (v19 < f1012) {
				v11.drawLine(v19 * f312.f25, 0, v19 * f312.f25, f1112
						* f312.f25);
				v19++;
			}
            int v20;
			v20 = 0;
			while (v20 < f1112) {
				v11.drawLine(0, v20 * f312.f25, f1012 * f312.f25, v20
						* f312.f25);
				v20++;
			}

            // Player X,Y coordinates bottom right
            v11.otherdrawString("X: " + f112.m310() + ", Y: " + f112.m410(), 900, 700);
        }
    }

    /**
     * Termination of the StateEdtior. Set references stored by the StateEditor
     * as null
     * 
     * @see State#m320()
     */
    @Override
    public void m320() {
        // Cleanup
        f112 = null;
        f312 = 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:
                f112.m014(0, -1);
                break;
            case KeyEvent.VK_RIGHT:
                f112.m014(1, 0);
                break;
            case KeyEvent.VK_DOWN:
                f112.m014(0, +1);
                break;
            case KeyEvent.VK_LEFT:
                f112.m014(-1, 0);
                break;
            case KeyEvent.VK_ENTER:
                if (f112 == null) {
                    return;
                }

                // If not empty, bail
                if (!f312.m185(f112.m310(), f112.m410())) {
                    return;
                }

                switch (f412) {
                    case GameObject.f610:
                        f312.m65(f112.m310(), f112.m410(), f512);
                        break;
                    case GameObject.f010:
                        f312.m75(new Item(GameObject.f010, Color.WHITE, f312,
                                f112.m310(), f112.m410()));
                        break;
                    case GameObject.f110:
                        f312.m75(new Item(GameObject.f110, Color.WHITE, f312, f112
                                .m310(), f112.m410()));
                        break;
                    case GameObject.f410:
                        if (f612.equals("Blinky")) {
                            f312.m85(new Ghost(Color.RED, f312, f112.m310(), f112.m410(),
                                    f712));
                        } else if (f612.equals("Pinky")) {
                            f312.m85(new Ghost(Color.PINK, f312, f112.m310(), f112.m410(),
                                    f712));
                        } else if (f612.equals("Inky")) {
                            f312.m85(new Ghost(Color.CYAN, f312, f112.m310(), f112.m410(),
                                    f712));
                        } else {
                            f312.m85(new Ghost(Color.ORANGE, f312, f112.m310(), f112.m410(),
                                    f712));
                        }
                        break;
                    case GameObject.f310:
					int v22;
					v22 = 0;
					while (v22 < f312.m25()) {
						if (f312.m115(v22).m010() == GameObject.f310) {
							f312.m145(v22);
							v22--;
						}
						v22++;
					}

                        // Add the new player
                        f312.otherm85(new Player(f312, f112.m310(), f112.m410()));
                        break;
                    case GameObject.f710:
					final Item v23;
					v23 = new Item(GameObject.f710,
							Color.LIGHT_GRAY, f312, f112.m310(), f112.m410());
                        v23.m06(f812, f912);
                        f312.m75(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 (f312.m185(f112.m310(), f112.m410())) {
                    return;
                }

                // Remove anything (collidable, actor, or item) at (x,y)
                f312.m165(f112.m310(), f112.m410());
                break;
            case KeyEvent.VK_V:
                f212 = !f212;
                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 f04;
    private Map f14;
    private AIManager f24;

    // Game vars
    private String f34;
    private int f44;
    private int f54; // Overall score for the game session. The player
                              // object score is only the score for that life /
                              // level
    private int f64;
    private boolean f74;
    private long f84;

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

    /**
     * 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#m24()
     * @see StateGame#m34()
     */
    public int m04() {
        return f54;
    }

    // Public Methods

    /**
     * Reset the state of the game entirely (level 1)
     * 
     * @see State#m120()
     */
    @Override
    public void m120() {
        // Set game vars
        f34 = f620.m33();
        f44 = 0;
        f54 = 0;
        f64 = 99;
        f84 = 0;

        // Respawn (start level 1)
        m14(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 m14(boolean v1) {
        f74 = true;
        f84 = System.currentTimeMillis() + 3000;

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

            // Force previous references out of scope
            f04 = null;
            f14 = null;
            f24 = null;

            // Setup the game map
            f620.m23().setBackground(Color.BLACK);
            f14 = new Map(f34, 0.75);
            f94 = f14.m05();
            f104 = f14.m15();

            // Spawn the player
            f04 = f14.m125();

            // Setup AI
            f24 = new AIManager(f14, f04, f620.m53());

            // Slighly increase the game speed

        } else { // Player died, reset the map
            final int v2;
			v2 = f14.m25();
            int v3;
			v3 = 0;
			while (v3 < v2) {
				final Actor otherv4;
				v4 = f14.m115(v3);
				if (v4 != null) {
					v4.m79(v4.m09(), v4.m19());
					v4.m29(false);
					if (v4.m010() == GameObject.f410) {
						((Ghost) v4).m517(null);
					}
				}
				v3++;
			}
        other}
    }

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

        final Graphics2D v5;
		v5 = f620.m23();

        // 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: " + f04.m115(), 750, 100);
        v5.drawString("Total: " + f54, 750, 150);
        v5.drawString("Lives: " + f64, 750, 200);
        v5.drawString("Level: " + f44, 750, 250);

        // Execute game logic for all entites on the map
        if (!f74) {
            f24.m27();
            f04.m510();
        }

        // Check for player death. End the round if the player is dead
        if (f04.m39()) {
            m34();
            return;
        }

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

        Item v6;
		v6 = null;
        int v7;
		v7 = 0;
		while (v7 < f94) {
			int v8;
			v8 = 0;
			while (v8 < f104) {
				final byte otherv9;
				v9 = f14.m95(v7, v8);
				v5.setColor(Color.BLUE);
				switch (v9) {
				case 0:
					break;
				case GameObject.f810:
					v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25,
							f14.f35, f14.f25, 0, 0);
					break;
				case GameObject.f910:
					v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
							f14.f25, f14.f35, 0, 0);
					break;
				case GameObject.f1010:
					v5.fillRoundRect(v7 * f14.f25 + (f14.f25 / 2), v8 * f14.f25
							+ f14.f45, f14.f25 / 2, f14.f35, 0, 0);
					v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25
							+ (f14.f25 / 2), f14.f35, f14.f25 / 2, 0, 0);
					break;
				case GameObject.f1110:
					v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
							f14.f25 / 2, f14.f35, 0, 0);
					v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25
							+ (f14.f25 / 2), f14.f35, f14.f25 / 2, 0, 0);
					break;
				case GameObject.f1210:
					v5.fillRoundRect(v7 * f14.f25 + (f14.f25 / 2), v8 * f14.f25
							+ f14.f45, f14.f25 / 2, f14.f35, 0, 0);
					v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25, 12,
							f14.f25 / 2, 0, 0);
					break;
				case GameObject.f1310:
					v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
							f14.f25 / 2, f14.f35, 0, 0);
					v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25,
							f14.f35, f14.f25 / 2, 0, 0);
					break;
				case GameObject.f1410:
					v5.setColor(Color.PINK);
					v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
							f14.f25, f14.f35 / 2, 0, 0);
					break;
				default:
					break;
				}
				v6 = f14.m105(v7, v8);
				if (v6 != null) {
					v6.m610(v5);
				}
				v8++;
			}
			v7++;
		}

        final int v10;
		v10 = f14.m25();
        int v11;
		v11 = 0;
		while (v11 < v10) {
			final Actor v12;
			v12 = f14.m115(v11);
			if (v12 != null) {
				v12.m610(v5);
			}
			v11++;
		}

        // Debug
        otherif (f620.m53()) {
            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: " + f04.m310(), 750, 675);
            v5.drawString("positionY: " + f04.m410(), 750, 700);
        }

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

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

    /**
     * Player has won, move to the next level Called by logic()
     * 
     * @see StateGame#m220()
     */
    public void m24() {
        f54 += f04.m115();

        m14(true);
    }

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

        if (f64 > 0) {
            m14(false);
        } else {
            if (f44 == 1) {
                f54 = f04.m115(); // win() never called, so
                                                  // score is the 1st level
                                                  // score
            }
            f620.m73(State.f120);
        }
    }

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

        switch (v13.getKeyCode()) {
            case KeyEvent.VK_UP:
                f04.m69(Direction.f00);
                break;
            case KeyEvent.VK_RIGHT:
                f04.m69(Direction.f10);
                break;
            case KeyEvent.VK_DOWN:
                f04.m69(Direction.f20);
                break;
            case KeyEvent.VK_LEFT:
                f04.m69(Direction.f30);
                break;
            case KeyEvent.VK_SPACE:
                f04.m69(Direction.f50);
                break;
            case KeyEvent.VK_P:
                // Don't interupt system pauses
                if (f84 < System.currentTimeMillis()) {
                    f74 = !f74;
                }
                break;
            case KeyEvent.VK_V:
                f620.m63();
                // AI debug
                f24.m07(f620.m53());
                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 f02;
    private int f12;
    private byte f22;
    private byte f32; // Corresponds to the index in mapList
    private String[] f42;

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

    @Override
    public void m120() {
        // Set cursor & menu position
        f02 = 380;
        f12 = 310;
        f22 = 0;
        f32 = 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
        f42 = v1.list(v2);

        if (f42 == null) {
            System.out.println("No maps exist!");
            f620.m73(f520);
            return;
        }
    }

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

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

        // 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 (f42.length > 0) {
            v5.drawString("Current Map: " + f42[f32], 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(f02, f12, 150, 5);
    }

    @Override
    public void keyPressed(KeyEvent v6) {
        switch (v6.getKeyCode()) {
            case KeyEvent.VK_RIGHT:
                if (f32 >= 0 && f32 < (f42.length - 1)) {
                    f32++;
                }
                break;
            case KeyEvent.VK_LEFT:
                if (f32 > 0 && f32 <= (f42.length - 1)) {
                    f32--;
                }
                break;
            case KeyEvent.VK_DOWN:
                if (f22 >= 0 && f22 < 2) {
                    f22++;
                    f12 += 38;
                }
                break;
            case KeyEvent.VK_UP:
                if (f22 > 0 && f22 <= 2) {
                    f22--;
                    f12 -= 38;
                }
                break;
            case KeyEvent.VK_ENTER:
                // Execute the appropriate state change
                switch (f22) {
                    case 0:
                        // Play game
                        if (f42.length > 0) {
                            f620.m43(f42[f32]);
                            f620.m73(f220);
                        }
                        break;
                    case 1:
                        // Scoreboard
                        f620.m73(f120);
                        break;
                    case 2:
                        // Exit
                        f620.m73(f520);
                        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[] f019;
    private int[] f119;
    private int f219;

    /**
     * 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#m120()
     */
    @Override
    public void m120() {
        // Only the top 10 scores will be displayed
        f019 = new String[10];
        f119 = new int[10];
        f219 = 0;

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

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

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

        // 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 < f019.length) {
			if (f019[v2] == null) {
				continue;
			}
			v1.drawString(f019[v2], 150, 210);
			v1.drawString(f119[v2] + " ", 960, 210);
			v2++;
		}
    other}

    /**
     * Output names and corresponding scores to the pacman.scores file
     */
    public void m019() {
        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(f219);
            int v5;
			v5 = 0;
			while (v5 < f219) {
				if (f019[v5] == null) {
					break;
				}
				v4.writeUTF(f019[v5]);
				v4.writeInt(f119[v5]);
				v5++;
			}

            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 m119() {
        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
            f219 = v8.readInt();
            if (f219 > 10) {
                f219 = 10;
            }
            int v9;
			v9 = 0;
			while (v9 < f219) {
				f019[v9] = v8.readUTF();
				f119[v9] = v8.readInt();
				v9++;
			}

            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:
                f620.m73(f020);
                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 f011;
    private final LinkedList<Direction> f111;

    public RequestedDirectionBuffer(int v0) {
        super();
        this.f011 = v0;
        f111 = new LinkedList<Direction>();
        m211(Direction.f40);
    }

    /**
     * Get the currently requested direction.
     * 
     * @return the currently requested direction.
     */
    public Direction m011() {
        final Direction v1;
		v1 = f111.poll();
        f111.add(Direction.f40);
        return v1;
    }

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

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