In the paclet, a sudoku is a Sudoku expression with two arguments. The first argument contains the information from which we can construct the groups and the numbers of the sudoku, the second argument contains only options for the display of the sudoku. So when we want to represent a sudoku by a string, this string must contain all information of the first argument.
The first step in making a string representation is that we store these data in integers of lists of integers.
The first list is the flattened list of the values of size, rowcolpositions and blockpositions, separated by the integer 0. In the example the list becomes {9,9,0,1,0,1}. We find back the three values by splitting the list at the inserted integer 0.
The values of outlinedgroups and coloredgroups are lists of lists of 9 integers. When we flatten these lists, we find back the original lists by partitioning with length 9.
Observe that from these three lists we can compute the groups of the sudoku, and therefore the cells of the sudoku.
A number value is either a list of one integer, which is a clue, or a list starting with 0, followed by the candidates in that cell. Clues and candidates will be treated differently.
For storing the clues, to each cell we assign 0 if there is no clue there and otherwise the clue itself.
We construct the digits of the numbers of the list:
Finally the list itself:
The string is pretty much shorter than the list. Let us have a look at the list for the candidates:
Finally, the string for the sudoku itself. It consists of 5 substrings, separated by the character '|', in this order:
The candidates are only included when the option InCludeCandidates is set to True. Otherwise this substring is empty.
The third string has a default value of "2gF&GRM", which corresponds to the size, rowcolpositions and standardpositions of a single standard sudoku. When such a sudoku has no other blocks, the string representation consists only of the clues.