sudoku.game
Class BoardState

java.lang.Object
  extended bysudoku.game.BoardState

public class BoardState
extends java.lang.Object

BoardState stores the current state of the board by keeping track of which values still remain playable. These are kept in a double array of ArrayLists of Integers. It interfaces to the GUI through the Board class.

Author:
sweis

Constructor Summary
BoardState(Board b)
          Create a new BoardState object.
 
Method Summary
 void play(Square square, int v)
          Attempts to set the argument Square to the given value then recalculates the possible values of all other Squares.
 void randomInit(int numSquares)
          Iniitializes a number of squares to random values and sets them as non-modifiable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoardState

public BoardState(Board b)
Create a new BoardState object.

Parameters:
b - The Board object used to access the GUI.
Method Detail

randomInit

public void randomInit(int numSquares)
Iniitializes a number of squares to random values and sets them as non-modifiable.

Parameters:
numSquares - The number of squares to randomly initialize

play

public void play(Square square,
                 int v)
Attempts to set the argument Square to the given value then recalculates the possible values of all other Squares.
If the Square is cleared, it's value is set to -1. Otherwise, if the value is not legal, nothing happens.

Parameters:
square - The Square to try to play.
v - The value to try to set the Square to.