frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Learning from Sudoku Solvers (2007)

http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.html
12•buescher•1w ago

Comments

MontagFTB•3h ago
There are plenty of posts out there on using Knuth’s dancing links as a fast sudoku solver. Has it fallen out of fashion?
mzl•3h ago
Dancing links is a very cute data-structure for a backtracking search, but there are a lot more aspects of writing a good Sudoku solver than just having a good data-structure for backtracking. Propagation (making deductions), heuristics, learning, parallelism, restarts, no-goods, ...

While 9x9 Sudoku problems are trivial to solve for more or less any program, 25x25 Sudoku instances are quite tricky and a simple and fast but naive search for a solution can easily take hours.

lightamulet•3h ago
Trying to represent sudoku as an integer program leads to a natural way to represent the board: a 9x9x9 boolean grid where x and y are the board dimensions and z is the number in each square.

You end up with three symmetric constraints + the box constraint:

- The sum along any x, y, or z row is 1 (one of each number per row, one of each number per column, and one number per square)

- The sum of each 3x3x1 box slice is 1 (one of each number per box)

I really like the symmetry between the row sum constraints here. And it does pretty neatly align with the way many people solve Sudoku by writing little numbers in the squares to represent possible values before pruning impossible ones.

mzl•3h ago
That representation of a Sudoku is elegant, but I think it is not the most natural representation. The base constraint programming style will use a variable per square with domain 1-9, and then 27 all_different constraints. This representation is a lot closer to how people talk about the rules of Sudoku, which in my mind makes it more natural.

A full MiniZinc program would look like this

    int: n = 3;
    int: s = n*n;
    set of int: S = 1..s;
    
    array[S, S] of opt S: puzzle;
    
    array[S, S] of var S: board;
    
    % Sudoku constraints
    constraint forall(row in S) ( all_different(board[row, ..]) );
    constraint forall(col in S) ( all_different(board[.., col]) );
    constraint forall(r, c in {1, 4, 7}) (
        all_different(board[r..<r+n, c..<c+n])
    );
    
    % Set up puzzle
    constraint forall (r, c in S where occurs(puzzle[r, c])) (
        board[r, c] = puzzle[r, c]
    );
    
    solve satisfy;

And an instance file looks like this

    puzzle = [|
         9, <>,  8,   1, <>, <>,  <>, <>,  4 |
         1,  2, <>,  <>,  8,  6,  <>,  5, <> |
        <>, <>,  7,  <>, <>, <>,  <>,  1, <> |
    
        <>,  8,  3,  <>, <>, <>,  <>,  6,  9 |
         7, <>,  6,   8, <>,  3,  <>, <>, <> |
        <>, <>, <>,   4,  6, <>,  <>,  8, <> |
    
        <>, <>, <>,  <>, <>,  1,  <>, <>, <> |
        <>, <>, <>,  <>, <>,  4,   5, <>,  1 |
         5,  4,  1,   9,  3,  8,  <>, <>, <>
    |];
reedlaw•3h ago
https://news.ycombinator.com/item?id=44220245 on the same topic was posted four months ago and has more substance than this short 2007 post.
srean•1h ago
Ravi Mohan is https://news.ycombinator.com/user?id=plinkplonk on HN. Hope he comments more, writes more.

Pg_lake: Postgres with Iceberg and data lake access

https://github.com/Snowflake-Labs/pg_lake
110•plaur782•2h ago•39 comments

Show HN: A CSS-Only Terrain Generator

https://terra.layoutit.com
177•rofko•4h ago•56 comments

Launch HN: Plexe (YC X25) – Build production-grade ML models from prompts

https://www.plexe.ai/
18•vaibhavdubey97•1h ago•2 comments

What is a manifold?

https://www.quantamagazine.org/what-is-a-manifold-20251103/
245•isaacfrond•8h ago•76 comments

Optimizing Datalog for the GPU

https://danglingpointers.substack.com/p/optimizing-datalog-for-the-gpu
64•blakepelton•3h ago•12 comments

Exploring a space-based, scalable AI infrastructure system design

https://research.google/blog/exploring-a-space-based-scalable-ai-infrastructure-system-design/
17•meetpateltech•1h ago•9 comments

Michael Burry a.k.a. "Big Short",discloses $1.1B bet against Nvidia&Palantir

https://sherwood.news/markets/michael-burry-big-short-discloses-1-1-billion-options-bet-against-n...
50•selim17•33m ago•22 comments

Recovering videos from my Sony camera that I stupidly deleted

https://www.jeffgeerling.com/blog/2025/recovering-videos-my-sony-camera-i-stupidly-deleted
20•speckx•1w ago•15 comments

Show HN: I built a local-first daily planner for iOS

https://apps.apple.com/ca/app/to-do-list-planner-zesfy/id6479947874
53•zesfy•4h ago•39 comments

This Day in 1988, the Morris worm infected 10% of the Internet within 24 hours

https://www.tomshardware.com/tech-industry/cyber-security/on-this-day-in-1988-the-morris-worm-sli...
104•canucker2016•2h ago•56 comments

Chaining FFmpeg with a Browser Agent

https://100x.bot/a/chaining-ffmpeg-with-browser-agent
61•shardullavekar•5h ago•36 comments

Bloom filters are good for search that does not scale

https://notpeerreviewed.com/blog/bloom-filters/
126•birdculture•8h ago•23 comments

How devtools map minified JS code back to your TypeScript source code

https://www.polarsignals.com/blog/posts/2025/11/04/javascript-source-maps-internals
20•manojvivek•2h ago•6 comments

My Truck Desk

https://www.theparisreview.org/blog/2025/10/29/truck-desk/
330•zdw•15h ago•69 comments

Customize Nano Text Editor

https://shafi.ddns.net/blog/customize-nano-text-editor
79•shafiemoji•1w ago•35 comments

The 512KB Club

https://512kb.club/
59•lr0•2h ago•35 comments

The Rust Foundation Maintainers Fund

https://rustfoundation.org/media/announcing-the-rust-foundation-maintainers-fund/
18•amalinovic•1h ago•3 comments

Tell HN: X is opening any tweet link in a webview whether you press it or not

356•stillatit•12h ago•322 comments

YouTube AI error costs creator his channel over alleged link to Japanese account

https://piunikaweb.com/2025/11/04/youtube-ai-error-terminates-enderman-channel/
71•rabinovich•1h ago•49 comments

Things you can do with diodes

https://lcamtuf.substack.com/p/things-you-can-do-with-diodes
328•zdw•18h ago•88 comments

You can't cURL a Border

https://drobinin.com/posts/you-cant-curl-a-border/
387•valzevul•17h ago•210 comments

Data breach at major Swedish software supplier impacts 1.5M

https://www.bleepingcomputer.com/news/security/data-breach-at-major-swedish-software-supplier-imp...
17•fleahunter•1h ago•5 comments

AI's Dial-Up Era

https://www.wreflection.com/p/ai-dial-up-era
405•nowflux•21h ago•365 comments

When stick figures fought

https://animationobsessive.substack.com/p/when-stick-figures-fought
295•ani_obsessive•17h ago•105 comments

US nuclear weapons testing can forever scar a nation.Just ask Marshall Island

https://www.cnn.com/2025/11/04/asia/nuclear-testing-marshall-islands-legacy-intl-hnk-dst
22•methuselah_in•1h ago•17 comments

Server DRAM prices surge 50% as AI-induced memory shortage hits hyperscalers

https://www.tomshardware.com/pc-components/storage/server-dram-prices-surge-50-percent
98•walterbell•2h ago•87 comments

Reverse-engineered CUPS driver for Phomemo receipt/label printers

https://github.com/vivier/phomemo-tools
67•Curiositry•1w ago•17 comments

Aisuru botnet shifts from DDoS to residential proxies

https://krebsonsecurity.com/2025/10/aisuru-botnet-shifts-from-ddos-to-residential-proxies/
33•feross•6d ago•10 comments

Tenacity – a multi-track audio editor/recorder

https://tenacityaudio.org
100•smartmic•1w ago•29 comments

A friendly tour of process memory on Linux

https://www.0xkato.xyz/linux-process-memory/
215•0xkato•19h ago•20 comments