The Hidden Logic of Sudoku