/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poulproj05;

/**
 *
 * @author marsh
 */
public class Creature {
    private int x_, y_;
    
    public static boolean goNorth(Maze maze, Creature creature)
    {
        boolean success = false;
        if(maze.isClear(creature.x_, creature.y_ +1))
        {
            creature.y_++;
            maze.markPath(creature.x_, creature.y_);
            if(maze.atExit(creature.x_, creature.y_))
                return true;
            else
            {
                success = goNorth(maze, creature);
                if(!success)
                {
                    success = goWest(maze, creature);
                    if(!success)
                    {
                        success = goEast(maze, creature);
                        if(!success)
                        {
                            success = goSouth(maze, creature);
                            if(!success)
                            {
                                maze.markVisited(creature.x_, creature.y_);
                                creature.y_--;
                            }
                        }
                    }
                }
                
            }
        }
        return success;
    }
    public static boolean goSouth(Maze maze, Creature creature)
    {
        boolean success = false;
        if(maze.isClear(creature.x_, creature.y_ +1))
        {
            creature.y_++;
            maze.markPath(creature.x_, creature.y_);
            if(maze.atExit(creature.x_, creature.y_))
                return true;
            else
            {
                success = goWest(maze, creature);
                if(!success)
                {
                    success = goEast(maze, creature);
                    if(!success)
                    {
                        success = goSouth(maze, creature);
                        if(!success)
                        {
                            maze.markVisited(creature.x_, creature.y_);
                            creature.y_--;
                        }
                    }
                }
                
            }
        }
        return success;
    }
    public static boolean goWest(Maze maze, Creature creature)
    {
        boolean success = false;
        if(maze.isClear(creature.x_, creature.y_ +1))
        {
            creature.y_++;
            maze.markPath(creature.x_, creature.y_);
            if(maze.atExit(creature.x_, creature.y_))
                return true;
            else
            {
                success = goNorth(maze, creature);
                if(!success)
                {
                    success = goWest(maze, creature);
                    if(!success)
                    {
                        success = goSouth(maze, creature);
                        if(!success)
                        {
                            maze.markVisited(creature.x_, creature.y_);
                            creature.y_--;
                        }
                    }
                }
                
            }
        }
        return success;
    }
    public static boolean goEast(Maze maze, Creature creature)
    {
        boolean success = false;
        if(maze.isClear(creature.x_, creature.y_ +1))
        {
            creature.y_++;
            maze.markPath(creature.x_, creature.y_);
            if(maze.atExit(creature.x_, creature.y_))
                return true;
            else
            {
                success = goNorth(maze, creature);
                if(!success)
                {
                    success = goEast(maze, creature);
                    if(!success)
                    {
                        success = goSouth(maze, creature);
                        if(!success)
                        {
                            maze.markVisited(creature.x_, creature.y_);
                            creature.y_--;
                        }
                    }
                }
                
            }
        }
        return success;
    }
    public int[] reportPosition()
    {
        return new int[]{x_, y_};
    }
}

@@ -3,203 +3,497 @@
 %0A * 
-To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage poulproj05;%0A%0A/**%0A *%0A * @author marsh%0A */%0Apublic class Creature %7B%0A    private int x_, y_;%0A    
+Contains the creature class partially specified in the project description%0A * by marsh Poulson 9/27/2013%0A */%0Apackage poulproj05;%0A%0A/**%0A * the creature class to represent the creature that moves through the maze%0A * north is y+, south y-, east x+, west x- %0A */%0Apublic class Creature %7B%0A    private int x_, y_;%0A    /*%0A     * returns the success of attempting to move the creature through the maze%0A     * attempt to go north first and then attempts to move in all of the other directions%0A     */
 %0A   

Update Creature.java