Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/wasm/sql/001-sudoku.sql # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / wasm / sql / 001-sudoku.sql` 28 lines ยท 892 bytes Raw Blame History 1 WITH RECURSIVE 2 input(sud) AS ( 3 VALUES('53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79') 4 ), 5 digits(z, lp) AS ( 6 VALUES('1', 1) 7 UNION ALL SELECT 8 CAST(lp+1 AS TEXT), lp+1 FROM digits WHERE lp<9 9 ), 10 x(s, ind) AS ( 11 SELECT sud, instr(sud, '.') FROM input 12 UNION ALL 13 SELECT 14 substr(s, 1, ind-1) || z || substr(s, ind+1), 15 instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' ) 16 FROM x, digits AS z 17 WHERE ind>0 18 AND NOT EXISTS ( 19 SELECT 1 20 FROM digits AS lp 21 WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1) 22 OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1) 23 OR z.z = substr(s, (((ind-1)/3) % 3) * 3 24 + ((ind-1)/27) * 27 + lp 25 + ((lp-1) / 3) * 6, 1) 26 ) 27 ) 28 SELECT s FROM x WHERE ind=0;