Task

Solve a partially filled-in normal   9x9   Sudoku grid   and display the result in a human-readable format.

references

 Algorithmics of Sudoku   may help implement this.
 Python Sudoku Solver Computerphile video.


code    ChOut=8, CrLf=9, IntOut=11, Text=12;
 
proc    Show(X);
char    X;
int     I, J;
[for I:= 0 to 8 do
        [if rem(I/3) = 0 then CrLf(0);
        for J:= 0 to 8 do
                [if rem(J/3) = 0 then ChOut(0, ^ );
                ChOut(0, ^ );  IntOut(0, X(0));
                X:= X+1;
                ];
        CrLf(0);
        ];
];
 
func    TryCell(X, Pos);
char    X;
int     Pos;
int     Row, Col, I, J, Used;
[Row:= Pos/9;
Col:= rem(0);
Used:= 0;
 
if Pos = 81 then return true;
if X(Pos) then return TryCell(X, Pos+1);
 
for I:= 0 to 8 do Used:= Used ! 1 << (X(I*9+Col)-1);
for J:= 0 to 8 do Used:= Used ! 1 << (X(Row*9+J)-1);
 
Row:= Row/3*3;
Col:= Col/3*3;
for I:= Row to Row+2 do
        for J:= Col to Col+2 do
                Used:= Used ! 1 << (X(I*9+J)-1);
 
for I:= 1 to 9 do
        [X(Pos):= I;
        if (Used&1)=0 & TryCell(X, Pos+1) then return true;
        Used:= Used>>1;
        ];
X(Pos):= 0;
return false;
];
 
proc    Solve(S);
char    S;
int     I, J, C;
char    X(81);
[J:= 0;
for I:= 0 to 80 do
        [repeat C:= S(J);
                J:= J+1;
        until   C>=^1 & C<=^9 ! C=^.;
        X(I):= if C=^. then 0 else C-^0;
        ];
 
if TryCell(X, 0) then Show(X)
else Text(0, "No solution");
];
 
[Solve("394 ..2 67.
        ... 3.. 4..
        5.. 69. .2.
        .45 ... 9..
        6.. ... ..7
        ..7 ... 58.
        .1. .67 ..8
        ..9 ..8 ...
        .26 4.. 735 ");
]