frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

My two year old taught me constraint solving

https://thecomputersciencebook.com/posts/how-my-2yo-taught-me-constraint-solving/
70•bambataa•1w ago

Comments

comrade1234•10h ago
Yon should publish this on LinkedIn.
akoboldfrying•8h ago
Given my feelings about the quality of the... discourse... on LinkedIn, I can't tell if this is a genuine compliment or a fiercely backhanded one.
hyperhello•9h ago
Sometimes you have to prove you’re #1 Dad.
zahlman•9h ago
The kid doesn't seem to be doing any actual teaching here. Cool that a two-year-old can say "exponential", though, I guess.

> “Dada! Degree three. No Euler circuit.”

…Oh. Okay, fine, weird rhetorical device but you do you.

dmoy•9h ago
While similarly playing brio with a two year old, I thought about a different dimension not mentioned here - super loose tolerances make the search space really weird.

In true 2-year-old fashion, my kid would bend the rules as much as possible by literally forcing pieces to the edge of their tolerance to make things fit that shouldn't fit. 8 piece circle yea, cool, but with a sufficiently old brio set handed down for 40 years or whatever, you can totally make a 7 piece "circle" thing.

So I decided some day I'll craft an interview question out of that, to see if people can figure out a good way to map a set of pieces laid out with given tolerance ranges for piece, see if it can connect, etc. Haven't thought about it enough to really polish it for an interview, but some day.

akoboldfrying•8h ago
I immediately got nerd-sniped by this...

A heuristic could try all kinds of fun force-directed placement stuff. For an exact solver, I think your best bet would (unfortunately) be to finely quantise the possible positions and orientations of each piece, describe each piece by 2 sets of positioned unit vectors (the vectors in one set start at the centre positions of each "hole" and are directed towards the centre of the piece, the other set is similar but holds the "plug" positions and orientations), and say that a partial solution is feasible iff every "plug" position is sufficiently far from all other plugs, and either sufficiently far from all other holes or within some small tolerances (in terms of both distance and angle) of some other hole. Actually, you would probably also need to treat the piece body as a "nothing else can occupy these positions" constraint. I say "unfortunate" because the position and orientation grids would need to be very fine relative to the size of the pieces, leading to a large state space thus long running times.

I think it would be fun to look for solutions that maximise the "badness" (e.g., sum of distances between matched holes and plugs) :)

bryanrasmussen•3h ago
>if people can figure out a good way to map a set of pieces laid out with given tolerance ranges for piece

so you work in some space where extremely good visual understanding and ability to abstract in 3 dimensions is a prerequisite?

mcphage•9h ago
What year was your son born? Nobody has said “Silly Billy” in 30 years, unless under the auspices of a duly appointed official.
nwiswell•8h ago
I associate that phrase with Dr. Henry Killinger

https://youtu.be/9FUik3QotBQ?si=27AcY47wLNov0Vzw

charcircuit•8h ago
This attempt at humble bragging about how smart your two year old is was not necessary for this article. There does not need to be a constant game of trying to 1 up other parents by bragging about how much farther ahead your kid is compared to others.
onaclov2000•7h ago
I'll be honest, while it's possible the article is genuine,at some point I felt/realized it seemed like an ad for the book, and made the story feel like it was not genuine and more like a contrived example of why the book is so useful and not real (again, not claiming real vs not real,just the vibe I felt) so I stopped reading.
Jtsummers•7h ago
> I'll be honest, while it's possible the article is genuine

No, there's not really much chance of that:

>> “Dada, real planners use SAT and its relatives for timetabling, chip layout, and routing for the same reason.”

polivier•7h ago
> When this solver backjumps, it forgets the failure as soon as it lands, so if the same dead end comes up in a different part of the search it gets rediscovered from scratch.

Modern solvers such as CP-SAT combine some SAT features with a CP solver, based of the work of Peter Stuckey I think.

olooney•7h ago
I wrote several polyomino solvers for this project:

https://www.oranlooney.com/demos/soma-forest/

One of them used constraint solving with Z3, which was indeed reasonably fast. However, by far the fastest was a simple backtracking solver written in Rust which used bit twiddling to quickly test for intersections. For polyomino's in particular, this represents between 10x and 100x constant speed boost, depending on the size of board. There's no way to get that back with a smarter solver.

efavdb•7h ago
My three year old taught me something he saw on a YouTube video: you can search through a maze and find your way out just by keeping your right hand on the wall at all times and continuing till exit. Does a DFS.
LeoPanthera•6h ago
This only works for two dimensional mazes where both the entrance and exit are on an edge and there are no loops in the maze.

If you introduce a bridge, or a tunnel, or put the goal in the middle, you can get stuck in a loop.

CGamesPlay•6h ago
Throw a loop/island in the maze and see how your kid reacts.
mohamedkoubaa•6h ago
I vaguely recall a windows screensaver that did this
RataNova•1h ago
A nice case of an algorithm being easier to learn physically than abstractly
elcaro•6h ago
Similar article I read 10 years ago that covers some of the same ground, with some pretty SVG's as well.

http://strangelyconsistent.org/blog/train-tracks

hexasquid•4h ago
Incredible. My two-year-old forgets to include Lambek when lecturing on Curry-Howard-Lambek correspondence. Kids.
akoboldfrying•3h ago
Insidious "gift" idea: A set of wooden track pieces with lengths and join angles chosen such that no subset of them can form a closed loop. No matter what you try, it's always just a little bit off.
RataNova•1h ago
The strongest insight here is that the SAT solver did not merely solve the same problem faster. It solved a better-formulated problem: choose the pieces as well as their placement.
wiredfool•54m ago
Had something similar to this with the kids with Lego Duplo tracks, similar topology but the switches gave the system state. Going "backwards" through a switch set the train to return that direction when coming the other way.

So we had a goal to make the train do interesting behaviors, like cover the entire track autonomously, pushing the switches itself. The biggest run I remember was a 4 bit counter.

Kid is now entering his last year of CS + Maths degree, so I guess it checks out.

NuclearPM•2h ago
Why would that be a good interview question?
RataNova•1h ago
That tolerance turns a clean combinatorial problem into a continuous one

Incremental – A library for incremental computations

https://github.com/janestreet/incremental
157•handfuloflight•4h ago•23 comments

Who's afraid of Chinese models?

https://stratechery.com/2026/whos-afraid-of-chinese-models/
593•mfiguiere•21h ago•400 comments

Running Doom on Our Custom CPU and Going Viral

https://www.armaangomes.com/blogs/doom/
53•arghunter•4h ago•10 comments

Kimi Work

https://www.kimi.com/products/kimi-work
522•ms7892•15h ago•225 comments

Jelly UI: Soft-body physics for native HTML form controls

https://jelly-ui.com/
463•baldvinmar•15h ago•150 comments

Five US tech giants' hidden debts soar to $1.65T on opaque AI funding

https://asia.nikkei.com/business/technology/five-us-tech-giants-hidden-debts-soar-to-1.65tn-on-op...
250•NordStreamYacht•4h ago•121 comments

Human mathematicians are being outcounterexampled

https://xenaproject.wordpress.com/2026/07/20/human-mathematicians-are-being-outcounterexampled/
323•artninja1988•13h ago•127 comments

A Koi Pond Mosaic Made from 10 Pounds of 3D Printer Waste

https://www.instructables.com/A-Koi-Pond-Mosaic-Made-From-10-Pounds-of-3D-Printe/
29•sudo_cowsay•4h ago•22 comments

Linux kernel will support $ORIGIN, sort of

https://fzakaria.com/2026/07/20/linux-kernel-will-support-origin-sort-of
21•ingve•1h ago•9 comments

How to pack ternary numbers in 8-bit bytes

https://compilade.net/blog/ternary-packing
6•JoshTriplett•6d ago•1 comments

Nativ: Run frontier open models locally on your Mac

https://blaizzy.github.io/nativ/
266•aratahikaru5•14h ago•87 comments

Flock Credibility Lost as It Repeatedly Lies to City Councils, Police, & Public

https://www.aclu.org/news/privacy-technology/tracking-alpr-cameras/flock-safety-credibility-lost-...
376•StatsAreFun•7h ago•103 comments

Show HN: Ex Situ – Open-source spatial index of displaced cultural artifacts

https://exsitu.app/map
27•hbyel•3h ago•13 comments

Show HN: Immersive Gaussian Splat tour of grace cathedral, San Francisco

https://vincentwoo.com/3d/grace_cathedral/
155•akanet•12h ago•33 comments

VTubing: How a Japanese Phenomenon Is Going Worldwide

https://www.tokyodev.com/articles/vtubing-how-a-japanese-phenomenon-is-going-worldwide
17•pwim•4h ago•1 comments

Agent swarms and the new model economics

https://cursor.com/blog/agent-swarm-model-economics
184•jlaneve•14h ago•83 comments

Launch HN: Bloomy (YC S26) – AI-powered mastery learning for K-12

85•alexsouthmayd•15h ago•86 comments

China’s open-weights AI strategy is winning

https://werd.io/american-ai-is-locked-down-and-proprietary-its-losing/
1093•benwerd•18h ago•831 comments

Tensor Notation in Mathup

https://mathup.xyz/#tensors
11•runarberg•6d ago•1 comments

The Psychology of Software Teams

https://www.routledge.com/The-Psychology-of-Software-Teams/Hicks/p/book/9781032963389
85•dcre•5d ago•22 comments

You only need the frontier model for one single edit

https://stencil.so/blog/prewalk
130•jxmorris12•6d ago•39 comments

The Power of Awareness: Overcoming Surveillance Capitalism

https://www.scottrlarson.com/presentations/overcoming-surveillance-capitalism-with-awareness/
101•trinsic2•12h ago•17 comments

My two year old taught me constraint solving

https://thecomputersciencebook.com/posts/how-my-2yo-taught-me-constraint-solving/
70•bambataa•1w ago•26 comments

Shinjuku Station in 3D

https://satoshi7190.github.io/Shinjuku-indoor-threejs-demo/
211•Gecko4072•18h ago•46 comments

I wrote an bash enumerator because I was sick of xargs

https://numerlab.org/2025/07/20/bashumerate-enumerator/
121•wallach-game•12h ago•101 comments

How we measured AI writing across arXiv, and where the measurement breaks

https://unslop.run/blog/measuring-ai-writing-on-arxiv
219•dopamine_daddy•15h ago•153 comments

Claude Fable produced a counterexample to the Jacobian Conjecture

https://xcancel.com/__alpoge__/status/2079028340955197566
746•loubbrad•1d ago•471 comments

Perfection is not over-engineering

https://var0.xyz/posts/perfection-is-not-over-engineering.html
236•var0xyz•18h ago•101 comments

Corners Don't Look Like That: Regarding Screenspace Ambient Occlusion (2012)

https://nothings.org/gamedev/ssao/
165•firephox•17h ago•70 comments

Hacker wipes Romania's land registry database

https://news.risky.biz/risky-bulletin-hacker-wipes-romanias-entire-land-registry-database/
637•speckx•18h ago•348 comments