Tomaz Kastrun builds a validation function for Sudoku:
Function validater will validate for the sudoku board a particular solution at a particular position:
validater(sudoku, 1, c(1,4))
In matrix, at position x=1, y=4, where there is 0, it will test if number 1 is valid or not. If the number is valid, it returns TRUE (number) to outer function for finding complete solution.
This function iterates through all the possible 0-positions and iterates through solutions that are still available based on the rules:
Click through for that validation function.