Class MySudoku

java.lang.Object
algs13.xbacktrack.xsudoku.MySudoku
All Implemented Interfaces:
XBacktrackProblem<algs13.xbacktrack.xsudoku.XMutableCell>

public final class MySudoku extends Object implements XBacktrackProblem<algs13.xbacktrack.xsudoku.XMutableCell>
A Sudoker solver, implemented as a BacktrackProblem where each choice is represented by a MutableCell (a cell we can assign a digit as part of a possible solution to Sudoku). This project represents a more substantial Java program than what we have been working with so far in the course. Search in this file and in algs13.xbacktrack.xframework.MyBacktrackDriver (MyBacktrackDriver.java)for some TODOs that will direct you to what you need to do for this assignment.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    advance(algs13.xbacktrack.xsudoku.XMutableCell previous)
    Determine if the backtracking driver can advance in searching for a solution from the state represented by previous choice.
    void
    initialize(MyBacktrackDriver<algs13.xbacktrack.xsudoku.XMutableCell> driver)
    Initialize the problem.
    static void
    main(String[] args)
     
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • initialize

      public void initialize(MyBacktrackDriver<algs13.xbacktrack.xsudoku.XMutableCell> driver)
      Description copied from interface: XBacktrackProblem
      Initialize the problem. The initialize method must call the track method on the driver to track the starting state.
      Specified by:
      initialize in interface XBacktrackProblem<algs13.xbacktrack.xsudoku.XMutableCell>
      Parameters:
      driver - The driver orchestrating the search for the solution.
    • advance

      public boolean advance(algs13.xbacktrack.xsudoku.XMutableCell previous)
      Description copied from interface: XBacktrackProblem
      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.
      Specified by:
      advance in interface XBacktrackProblem<algs13.xbacktrack.xsudoku.XMutableCell>
      Parameters:
      previous - 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).
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)