Package sudoku

Class Sudoku


  • public class Sudoku
    extends Object
    Class representing Sudoku riddle.
    • Field Detail

      • _rank

        private final int _rank
        Size of a single (small) sudoku square (aka. block)
      • _size

        private final int _size
        Board size
      • _board

        private int[][] _board
        Current values of board fields
      • _mask

        private boolean[][] _mask
        Array of flags indicating hard-coded board fields. If true, field cannot be modified.
    • Constructor Detail

      • Sudoku

        public Sudoku​(int rank)
      • Sudoku

        public Sudoku​(Sudoku sudoku)
    • Method Detail

      • getBoard

        public int[][] getBoard()
      • setBoard

        public void setBoard​(int[][] board)
        Set board default state.
        Parameters:
        board - 2d array of sudoku digits (0 means that the field is empty)
      • reset

        public void reset()
        Reset board to default state. Sets all unmasked board fields to zero (empty).
      • insertDigit

        public void insertDigit​(int x,
                                int y,
                                int digit)
      • getDigit

        public int getDigit​(int x,
                            int y)
      • getMask

        public boolean getMask​(int x,
                               int y)
      • getSize

        public int getSize()
      • getRank

        public int getRank()
      • getPlayerCount

        public int getPlayerCount()
      • getTableCount

        public int getTableCount()
      • getEmptyFieldsCount

        public int getEmptyFieldsCount()
      • printNatural

        public void printNatural()
        Prints the board of the Sudoku in natural, human-friendly style.