Skip to main content
21 votes
Accepted

Maximize Sudoku King's tour

Python + Z3, 999899898789789787876789658767666545355432471632124566352413452143214125313214321, optimal Runs in about half an hour, producing ...
Anders Kaseorg's user avatar
15 votes
Accepted

The fastest Sudoku solver

C++ - 0.201s official score Using Tdoku (code; design; benchmarks) gives these results: ~/tdoku$ lscpu | grep Model.name Model name: Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz ~/tdoku$ # ...
53x15's user avatar
  • 349
12 votes

Output a Sudoku board

Python 2, 47 bytes l=range(1,10) for x in l:print(l*9)[x*8/3:][:9] Try it online!
xnor's user avatar
  • 147k
11 votes

Validate Sudoku on a Mobius Strip

05AB1E, 54 47 bytes 3δôø˜©‚˜9ôI2ä`í«ø«D€ÙQIÂí‚øε˜Ć}D€ÔQ®9ô€Ås9L¢<PP Takes the input as a 6x27 matrix, kinda like the reference screenshot of the grid. Outputs <...
Kevin Cruijssen's user avatar
10 votes

Draw a sudoku board using line drawing characters

Python 3, 232 bytes Thanks to those who helped to golf this down. Encryption within encryption... ...
Leaky Nun's user avatar
  • 50.1k
10 votes

Counting valid Binary Sudoku rows

Jelly,  13 12  9 bytes ŻcṚ$+Ḋ$²S Try it online! Or see the test-suite. How? This code is calculating $$\sum_{k=\lceil\frac{n}{2}\rceil}^{n}\big(\...
Jonathan Allan's user avatar
9 votes

Output a Sudoku board

T-SQL, 96 89 bytes Found one shorter than the trivial output! SELECT SUBSTRING('12345678912345678',0+value,9)FROM STRING_SPLIT('1,4,7,2,5,8,3,6,9',',') Extracts 9-...
BradC's user avatar
  • 6,812
9 votes

The fastest Sudoku solver

C - 0.045s unofficial score I got this time on my i7-9750H with 6 cores 12 threads @ 4Ghz. I'm aware that my cpu is faster than the i7-7700HQ so I think (hope) it would be closer to 0.080s if it were ...
Mirage's user avatar
  • 91
8 votes

Draw a sudoku board using line drawing characters

C (gcc), 398 395 291 bytes Saved 3 bytes by working through the string reversed, and 104 (!) bytes thanks to Leaky Nun. ...
Conor O'Brien's user avatar
8 votes

The fastest Sudoku solver

Node.js, 8.231s 6.735s official score Takes the file name as argument. The input file may already contain the solutions in the format described in the challenge, in which case the program will ...
Arnauld's user avatar
  • 198k
7 votes

Draw a sudoku board using line drawing characters

PHP, 297 bytes ...
Jörg Hülsermann's user avatar
7 votes

Create a diagonal sudoku board

APL (Dyalog Unicode), 56 bytes (,⊖⍣(?2)↑a(3+⍳3)(10-⌽a←3?3)){⍺ ⍺⌷9 9⍴∊⌽⍵∘.⌽⍵⊖¨⊂3 3⍴⍳9}⍳3 Try it online! A full program that randomly gives a 9-by-9 matrix of ...
Bubbler's user avatar
  • 78.4k
7 votes

Output a Sudoku board

Jelly, 7 bytes 9Rṙ%3$Þ Try it online! And a little bit of this... -1 thanks to Jonathan Allan('s thinking?)
Erik the Outgolfer's user avatar
6 votes

Output a Sudoku board

JavaScript (Node.js), 47 bytes Output as an array of the rows. _=>[...w="147258369"].map(x=>(w+w).substr(x,9)) Try it online! Generates this: 472583691 ...
Shieru Asakoto's user avatar
6 votes

Output a Sudoku board

Python 2, 53 bytes r=range(9) for i in r:print[1+(j*10/3+i)%9for j in r] Try it online! Alternatives: Python 2, 53 bytes ...
TFeld's user avatar
  • 19.9k
6 votes

Is this board Latin-style?

Jelly, 24 bytes ,ZµŒgaS$€F)Zṣ€0Ṣ<JƊ€€)FẸ Try it online! A monadic link taking as its argument the grid as a matrix with 1 representing squares needing a ...
Nick Kennedy's user avatar
  • 21.2k
6 votes

Counting valid Binary Sudoku rows

Pari/GP, 77 bytes n->polcoeff([x,0,1,0]*[0,x,1,0;0,0,1,0;x,0,0,1;x,0,0,0]^(2*n-1)*[1,1,1,1]~,n) Try it online! This uses a nice method involving automata and ...
Christian Sievers's user avatar
6 votes

Sudoku as a SAT problem

Python3, 427 bytes ...
Ajax1234's user avatar
  • 7,711
5 votes

Find the rows which make each column have one True (was: Knuth's Algorithm X)

Haskell, 100 93 92 87 83 80 bytes Knuth's algorithm: g&c=filter(g.any(`elem`c)) (u:v)%a=[c:s|c<-id&u$a,s<-(not&c)v%(not&c$a)] x%_=[x] ...
Angs's user avatar
  • 4,987
5 votes

Draw a sudoku board using line drawing characters

T-SQL, 445 437 bytes (in 381 characters) ...
BradC's user avatar
  • 6,812
5 votes

Output a Sudoku board

Python 3, 58 55 bytes l=*range(10), for i in b" ":print(l[i:]+l[1:i]) Try it online! -3 bytes thanks to Jo King, The ...
dylnan's user avatar
  • 5,374
5 votes
Accepted

Morse sudo-ku-de

APL (Dyalog Extended), 42 bytesSBCS Anonymous tacit prefix function. ⌂morse{1↓∊' ',¨⍺⍺∊⍕¨⊃⌂sudoku⍎¨9 9⍴⍺⍺⍵⊆⍨≠⍵} Try it online! ...
Adám's user avatar
  • 31.1k
5 votes

Counting valid Binary Sudoku rows

Bash + GNU utilities, 123 121 119 bytes ...
Mitchell Spector's user avatar
5 votes

Solving an easy Sudoku in increasing digit order

JavaScript (ES6), 239 bytes Returns a string of digits, or undefined if no set at all was completed. ...
Arnauld's user avatar
  • 198k
4 votes

Draw a sudoku board using line drawing characters

Retina, 196 167 bytes ...
Neil's user avatar
  • 177k
4 votes

Retrieve all possible marks that can be placed in a Sudoku puzzle

C (gcc), 193 bytes ...
orlp's user avatar
  • 39.2k
4 votes

Draw a sudoku board using line drawing characters

JavaScript (ES6), 246 bytes / 198 chars ...
Justin Mariner's user avatar
4 votes

Output a Sudoku board

Jelly, 9 8 bytes 9Rṙ`s3ZẎ Try it online! ...
dylnan's user avatar
  • 5,374
4 votes

Output a Sudoku board

Batch, 84 bytes @set s=123456789 @for %%a in (0 3 6 1 4 7 2 5 8)do @call echo %%s:~%%a%%%%s:~,%%a%% Uses @Mnemonic's output. ...
Neil's user avatar
  • 177k

Only top scored, non community-wiki answers of a minimum length are eligible