/* * This class will use recursion to solve a swamp. */ public class SwampSolver { private Swamp swamp; private int jump; /* * Declare any instance or class variables here */ /* * This is the constructor. Given a properly constructed Swamp, * It should set things up for the solve() method, &c to do * the "real world" */ public SwampSolver(Swamp swamp) { this.swamp = swamp; jump = swamp.getJump(); /* * Initialize any new instance variables here */ } /* * This is a wrapper for the recursive solve method. It should do * very little -- really just call that with the right paramters. * It basically exists to hide the complex paramterization from * the users. */ public boolean solve() { return solve_recursive(swamp.getStart().getRow(), swamp.getStart().getCol()); } /* * This is the "meat and potatoes". This method should use recursion * to solve the swamp. It should return "true" if the swamp has a solution * and "false" otherwise. It should also set up the data structure * so that toString() can produce the path that was used from start to * the edge of the swamp * * "current" is the current position in the swamp -- this is initally * start. * * Unlike the maze, we are not going to use previous. Instead, we're * going to mark the cells. Unlike the maze, things aren't linear this * time, we can find ourselves back in the same place in potentially * many ways. Take a look at markCell() in the Maze class. */ private boolean solve_recursive(int row, int col) { /* * Your code goes here */ } // This should convert the swamp and the path through the swamp to a String. public String toString() { /* * Your code goes here */ } // This should be your test driver public static void main(String args[]) throws Exception { /* * Your code goes here */ } }