Brachylog, 245 bytes /2 = 122.5
(Note that you have to use the version of the language as of this commit. This code would need some slight changes for it to work properly in the following versions of Brachylog)
"!!" if the given board has internal contradictions (This takes a few seconds in that case however on TIO, so be patient).
I'm not sure I understand the first bonus correctly so I'm not addressing it.
This is obviously non-competing since the language is much more recent than the challenge, however since there are no other answers I'm not sure this matters a whole lot…
@n Split the input on line breaks
:1a:"-"x Transform into a list of lists, each sublist contains a line's values
:7fF Transform so that cells are [Value:X:Y]
:3a All values on lines must be different
$\:3a All values on columns must be different (by transposition)
@3:4a, All 3*3 block values must be different
Fc~bCh[0:0:0]gO, Append a fake cell [0:0:0]
Co~c[V:O:T] Sort the board, the blank cells V will be those before O ([0:0:0])
h:F:6f Find all subsets of blank cells with specific values for which
the board has only one solution
:10ao Sort the subsets by lengths
:ba Discard the lengths
h:11a Print the first subset = an answer
; Or (board is already fully determined)
; Or (Some values don't respect the constraints)
"!!"w! Print "!!" and terminate
Predicate 1: Remove all "
|" on lines, transform the
- to remove them after
h"-". If the first char is "-", then Output is "-"
:"|"x Remove all occurences of "|" from the input
:2f. Output is the result of all outputs of predicate 2 on the filtered string
Predicate 2: Convert one char to an integer, or if blank to a variable between 1 and 9.
e Take a char of the input string
~m["0123456789":.] Output is the index of the char in "0123456789"
` Discard the choice point caused by the ;
0<.<=9 Output is an integer between 1 and 9
Predicate 3: Impose that all values of the input list of cells must be distinct
:ha Retrieve the head of each cell (i.e. the value) in the input
#d. Apply a constraint of distinctness to those values
Predicate 4: Apply the distinctness constraint to values in 3*3 blocks
:@3a Split 3 lines of the board in 3 parts
z Zip them together
:ca:5a. Concatenate each element of the zip, apply predicate 5 to that
:3a. Apply predicate 3 to each element of the input
Predicate 6: Assign values satisfying the constraints to a subset of the blank cells, then with those values there is only one solution to the board.
hs. Output is a subset of the blank cells
:=a, Assign values to those cells
?t:9ac Concatenate the values of all cells of the board
:=f Find all solved boards
l1 There is only 1 such solved board
Predicate 7: Transforms the board such that each cell is now
[V:X:Y] instead of only
V (the value).
:Im Take the Ith line of the board
:8f Transform all elements of the line using predicate 8
:[[I]]z Zip the result with [I]
:ca. Concatenate each element of the zip
Predicate 8: Transforms a line such that each cell is now
:Jm Take the Jth element of the line
:J. Output is [That element:J]
Predicate 9: Retrieve the values of cells
:ha. Take the head of each element of the input
Predicate 10: Append the length of a subset at the beginning of it
lg Put the length of the input in a list
:?c. Concatenate it with the input
Predicate 11: Print one cell
b:+a[X:Y], Increment coordinates by 1 to get X and Y
?h:Y:Xr: Build the list [X:Y:Value]
"(~d,~d):~d\n"w Format that list as "('X','Y'):'Value'\n" to STDOUT