This method checks one of the non-whitespace characters
in the input for validity. It returns 0 for ".", and the equivalent integer for digits.
All other values fail.
# - - - S u d o k u S o l v e r . _ _ r e a d C h a r - - -
def __readChar ( self, c ):
"""Translate one input character.
[ c is a one-character string ->
if c is "." ->
return 0
else if c is a digit in ["1", "9"] ->
return int(c)
else -> raise ValueError ]
"""
if c == ".":
return 0
elif "1" <= c <= "9":
return int(c)
else:
raise ValueError, ( "Invalid sudoku character: '%s'" %
c )
There is no trace table for this method. Verification is by inspection.