<commit_before>/**
 * A standard sudoku solver using recursive backtracking
 * @author <NAME>
 * @version 2.3
 * Created by patch on 2015-12-26.
 */
public class SudokuSolver {
    private int N; //standard sudoku grid of size NxN
    private int E; //empty cell
    private int[][] sudokuGrid;

    //constructor
    public SudokuSolver(){
        N = 9; //9x9 grid
        E = 0; //0 means empty cell
    }// end SudokuSolver

    /**
     * Checks if number inserted appears twice in its 3x3 subgrid
     * @param grid - sudoku array to be evaluated
     * @param num - number to be inserted and evaluated
     * @param row - row where number will be inserted
     * @param col - col where number will be iserted
     * @return true if number doesn't appear twice in its 3x3 subgrid and false if it does
     */
    private boolean checkSubgrid(int[][] grid, int num, int row, int col){
        //mod 3 to determine the (0,0) coordinate of the subgrid
        row = row - (row % 3);
        col = col - (col % 3);

        //iterate and check entire subgrid for duplicate digit
        for(int i = 0; i < 3; ++i)
            for(int j = 0; j < 3; ++j)
                if(grid[i + row][j + col] == num)
                    return false;
        return true;
    }// end checkSubgrid

    /**
     * Checks if number inserted appears twice in the same column
     * @param grid - sudoku array to be evaluated
     * @param num - number to be inserted and evaluated<commit_msg>fixed spelling<commit_after>/**
 * A standard sudoku solver using recursive backtracking
 * @author <NAME>
 * @version 2.3
 * Created by patch on 2015-12-26.
 */
public class SudokuSolver {
    private int N; //standard sudoku grid of size NxN
    private int E; //empty cell
    private int[][] sudokuGrid;

    //constructor
    public SudokuSolver(){
        N = 9; //9x9 grid
        E = 0; //0 means empty cell
    }// end SudokuSolver

    /**
     * Checks if number inserted appears twice in its 3x3 subgrid
     * @param grid - sudoku array to be evaluated
     * @param num - number to be inserted and evaluated
     * @param row - row where number will be inserted
     * @param col - col where number will be inserted
     * @return true if number doesn't appear twice in its 3x3 subgrid and false if it does
     */
    private boolean checkSubgrid(int[][] grid, int num, int row, int col){
        //mod 3 to determine the (0,0) coordinate of the subgrid
        row = row - (row % 3);
        col = col - (col % 3);

        //iterate and check entire subgrid for duplicate digit
        for(int i = 0; i < 3; ++i)
            for(int j = 0; j < 3; ++j)
                if(grid[i + row][j + col] == num)
                    return false;
        return true;
    }// end checkSubgrid

    /**
     * Checks if number inserted appears twice in the same column
     * @param grid - sudoku array to be evaluated
     * @param num - number to be inserted and evaluated
{'fraction_non_alphanumeric': 0.09404600811907984, 'fraction_numerical': 0.018944519621109608, 'mean_word_length': 2.0866388308977037, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1420321', 'n_tokens_mistral': 897, 'n_tokens_neox': 847, 'n_words': 384}