TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Solving domino fit using constraint programming

59 pointsby polivierabout 1 year ago

9 comments

rjeliabout 1 year ago
Nice! I rewrote it in z3 and was able to avoid the if-elses by tracking the occupancy of each cell as an integer, and constraining it to exactly 1: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;rjeli&#x2F;a1612da0e3c8b99ec4514e689ebdfa85" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;rjeli&#x2F;a1612da0e3c8b99ec4514e689ebdfa...</a>
评论 #39868932 未加载
uxamandaabout 1 year ago
Off topic from the solver, which is neat to read through - I’m still a big fan of this game. Looks like I’ve played 33 days of the past ~40 days. My only critique is that the UI design of the end state could be improved. Lots of very small fonts.
from-niblyabout 1 year ago
Constraint programming is awesome. I learned prolog in college which can accomplish similar stuff. One of thw things thats cool is you are badically just describing the problem and the rules. As soon as you are done with that the problem is already solved.
bronco21016about 1 year ago
I love seeing this worked through step by step. Does anyone know of other blog posts where constraint programming is applied step by step to a problem?
评论 #39868915 未加载
评论 #39869534 未加载
评论 #39869351 未加载
evrimoztamurabout 1 year ago
I have a hunch that we&#x27;re going to see this on next year&#x27;s Advent of Code...
ulcharabout 1 year ago
I know these are the times of big machine learning models, but my favourite kind of AI are the classics like CSAT solvers, minimax with alpha beta pruning, markov chains, and good old search trees. These algorithms have superhuman powers solving so many challenging games and problems just by converting the problem space into a search tree. Love it.
akoboldfryingabout 1 year ago
Nice, I haven&#x27;t come across this library before.<p>One minor suggestion: You could remove all of the corner and border special cases for overlap testing by making the grid 2 columns wider and 2 rows taller, offsetting all coordinates by 1, and pretending that the outer &quot;border&quot; on all sides of this slightly larger grid is covered with black cells.
tombertabout 1 year ago
It&#x27;s definitely not optimal, but I love doing this stuff with TLA+. You define rules for state transitions, and constraints that cannot happen, and then you run a model check.<p>There&#x27;s probably better ways of doing it, but I already know TLA+ and TLC does a breadth-first search so it&#x27;ll find the shortest path.
polivierabout 1 year ago
This is a solver for the game Domino Fit that was talked about on HN last month: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39420966">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39420966</a>