Interface XBacktrackProblem<T>

Type Parameters:
T - The type of the choices made in the backtracking problem.
All Known Implementing Classes:
MySudoku

public interface XBacktrackProblem<T>
A interface defining a backtracking problem to be solved with the backtracking framework.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    advance(T state)
    Determine if the backtracking driver can advance in searching for a solution from the state represented by previous choice.
    void
    Initialize the problem.
  • Method Details

    • initialize

      Initialize the problem. The initialize method must call the track method on the driver to track the starting state.
      Parameters:
      driver - The driver orchestrating the search for the solution.
    • advance

      boolean advance(T state)
      Determine if the backtracking driver can advance in searching for a solution from the state represented by previous choice. If it can, this method must either call the track method on the driver to track the next choice, or it must call the driver's setDone() method.
      Parameters:
      state - The previous choice
      Returns:
      true if the current state consists of a valid partial solution, or the current state represents a complete solution (i.e. the last choice required to solve the problem has been made).