Examples of Candidates


Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

            }
        }
    }

    private void checkNakedSubset(CellSet cells) {
        Candidates foundSubset = null;
        Set<Integer> matches = null;

        for (int i=0; i<cells.numCells(); i++) {
            Candidates cands = cells.getCell(i).getCandidates();
            matches = new HashSet<Integer>();
            matches.add(i);
            if (cands != null)  {
                int n = cands.size();
                for (int j=0; j<cells.numCells(); j++) {
                    Candidates cands2 = cells.getCell(j).getCandidates();
                    if (j!=i && cands2!=null && cands.containsAll(cands2)) {
                       matches.add(j);
                    }
                }
                if (matches.size() == n) {
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

    /**
     * If the outside cell has only 2 values and one of them is a value that must be in the bigCell
     * then the other value can be set.
     */
    private void checkIfCanSetOutsideCellValue(int value, Cell cell) {
        Candidates cands = cell.getCandidates();
        if (cands != null && cands.size() == 2 && cands.contains(value)) {
            for (int candValue : cands) {

                if (candValue != value) {
                    cell.setValue(candValue);
                }
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

        List<Candidates> cands = new ArrayList<Candidates>();

        int n = bigCell.getSize();
        for (int i = 0; i <n; i++) {
           for (int j = 0; j < n; j++) {
               Candidates c = bigCell.getCell(i, j).getCandidates();
               if ((i != row || j != col) && c != null) {
                   cands.add(c);
               }
           }
        }
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

    private CandidatesArray getCandidatesArrayForRowExcludingCol(int row, int col) {
        List<Candidates> cands = new ArrayList<Candidates>();

        for (int i = 0; i < board.getEdgeLength(); i++) {
           Candidates c = board.getCell(row, i).getCandidates();
           if ((i != col) && c != null) {
               cands.add(c);
           }
        }
        return new CandidatesArray(cands.toArray(new Candidates[cands.size()]));
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

    private CandidatesArray getCandidatesArrayForColExcludingRow(int row, int col) {
        List<Candidates> cands = new ArrayList<Candidates>();

        for (int i = 0; i < board.getEdgeLength(); i++) {
           Candidates c = board.getCell(i, col).getCandidates();
           if ((i != row) && c != null) {
               cands.add(c);
           }
        }
        return new CandidatesArray(cands.toArray(new Candidates[cands.size()]));
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

    private void checkAndSetLoneRangers(CandidatesArray candArray, Cell cell) {

        if (cell.getCandidates() == null) return;

        Candidates candsCopy = cell.getCandidates().copy();

        int i=0;
        while (i<candArray.size() && candsCopy.size() > 0) {

            Candidates c = candArray.get(i++);
            if (c != null)  {
                candsCopy.removeAll(c);
            }
        }
View Full Code Here

Examples of com.barrybecker4.puzzle.sudoku.model.board.Candidates

    private void checkAndSetUniqueValues() {

        for (int row = 0; row < board.getEdgeLength(); row++) {
            for (int col = 0; col < board.getEdgeLength(); col++) {
                Cell cell = board.getCell(row, col);
                Candidates cands = cell.getCandidates();
                if (cands!=null && cands.size() == 1) {
                    int unique = cands.getFirst();
                    cell.setValue(unique);
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.