frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Constraint satisfaction to optimize item selection for bundles in Minecraft

https://www.robw.fyi/2025/10/12/using-constraint-satisfaction-to-optimize-item-selection-for-bundles-in-minecraft/
18•someguy101010•6h ago

Comments

Liftyee•3h ago
Neat idea, though I didn't fully understand the details since I'm not experienced in constraint solvers. Might have to look into it.

Games often lead to interesting computational problems. Another example - I was designing a solver for Flow [0] which made me think about graph problems and applications in e.g. circuit board wire routing. Intuitively it's easy, but translating that into logic is more challenging.

[0] https://en.wikipedia.org/wiki/Flow_Free

ViscountPenguin•3h ago
Back in uni, we had to design a MIP program to solve flow, it was a nice and fun problem.

Turns out you can save a lot of time and effort by just cutting infeasible solutions out one by one, and resuming the solver, as opposed to writing some tricky constraints.

charcircuit•3h ago
>You have 27 inventory slots, 9 hotbar slots, 4 armor slots, 4 temporary crafting slots, 1 offhand slot, and 1 temporary slot for the result of crafting.

There is also a slot for your cursor. When your inventory is open you can click on an item to put it in your cursor slot and it will allow you to pick up an additional item.

someguy101010•2h ago
Thanks for catching this!
SOTGO•1h ago
I get that the author wanted to explore constraint solvers, but why can't you use a greedy algorithm for this problem? Sort the inventory slots by how much bundle space they consume, and insert the cheapest slots. The only way I see this failing is with multiple bundles, but in practice in Minecraft (which is admittedly not really part of the constraint problem) bundles only help when you have many distinct items but a large number of items occur only a few items. In that case it isn't hard to find combinations that fill each bundle completely by only inserting all of a given item (as opposed to inserting only part of an inventory slot) since many items will have only 1 or 2 copies.
someguy101010•1h ago
I opt for the greedy strategy in most game play scenarios for pretty much the reasons you described here. I was considering making a mod to perform this action for me and was looking for a more "correct" solution but greedy is way simpler and just as effective for most cases.
akoboldfrying•43m ago
If you greedily fill bundles by first inserting all weight-4 items (pearls, etc.) in any order into a single bundle, moving to a new bundle each time the current one gets full, then inserting all weight-1 items (sticks, etc.) in any order in the same way, the solution you get will use an optimal number of bundles, and also leave an optimal amount of free capacity in the final bundle. (It helps to notice that every bundle except the last must be completely full with no wasted space, since both 4 and 1 divide 64.)

If you do the same, but add all weight-1 items before adding all weight-4 items, you'll still get a solution using the same (optimal) number of bundles, but you may use more capacity in the final bundle than needed -- e.g., if you have 61 sticks and 1 pearl, and add them in that order, the first bundle wastes 3 slots and the second uses 4 slots (vs. no wasted space in the first bundle and just 1 slot used in the second if adding in the reverse order).

OTOH, if you mix adding items of different weights (while staying with the approach of only ever adding to the current bundle if there's room, and if not, moving to a fresh bundle) then you can arrive at a suboptimal number of bundles. E.g., adding 61 sticks, 1 pearl and 3 dirt in that order will require 3 bundles instead of the optimal 2.

doctorpangloss•1h ago
This is cool.

Another POV is, is any game made better by having serious constraint satisfaction problems hiding inside of it?

Before I get flamed for the question, another way of stating the question is, would Minecraft be made better if it didn’t limit the inventory size, or if the inventory limits were so simple as to not require any kind of constraint satisfaction, whether traditional (ie reading a wiki what to do) or programmatic?

Wireguard FPGA

https://github.com/chili-chips-ba/wireguard-fpga
325•hasheddan•7h ago•89 comments

Edge AI for Beginners

https://github.com/microsoft/edgeai-for-beginners
95•bakigul•4h ago•27 comments

Everything You Need to Know About [California] SB 79

https://mnolangray.substack.com/p/everything-you-need-to-know-about
11•bickfordb•47m ago•1 comments

Ask HN: What are you working on? (October 2025)

96•david927•4h ago•217 comments

Emacs agent-shell (powered by ACP)

https://xenodium.com/introducing-agent-shell
97•Karrot_Kream•4h ago•7 comments

Show HN: Baby's First International Landline

https://wip.tf/posts/telefonefix-building-babys-first-international-landline/
18•nbr23•4d ago•2 comments

Three ways formally verified code can go wrong in practice

https://buttondown.com/hillelwayne/archive/three-ways-formally-verified-code-can-go-wrong-in/
55•todsacerdoti•18h ago•27 comments

Bird Photographer of the Year Gives a Lesson in Planning and Patience

https://www.thisiscolossal.com/2025/09/2025-bird-photographer-of-the-year-contest/
52•surprisetalk•6d ago•10 comments

Macro Splats 2025

https://danybittel.ch/macro.html
373•danybittel•14h ago•60 comments

Database Linting and Analysis for PostgreSQL

https://pglinter.readthedocs.io/en/latest/
18•fljdin•4d ago•3 comments

3D-Printed Automatic Weather Station

https://3dpaws.comet.ucar.edu
27•hyperbovine•3d ago•5 comments

Tiny Teams Playbook

https://www.latent.space/p/tiny
69•tilt•4d ago•20 comments

Completing a BASIC language interpreter in 2025

https://nanochess.org/ecs_basic_2.html
49•nanochess•5h ago•3 comments

Free software hasn't won

https://dorotac.eu/posts/fosswon/
113•LorenDB•3h ago•133 comments

A whirlwind introduction to dataflow graphs (2018)

https://fgiesen.wordpress.com/2018/03/05/a-whirlwind-introduction-to-dataflow-graphs/
22•shoo•1d ago•0 comments

Constraint satisfaction to optimize item selection for bundles in Minecraft

https://www.robw.fyi/2025/10/12/using-constraint-satisfaction-to-optimize-item-selection-for-bund...
18•someguy101010•6h ago•8 comments

Show HN: I built a simple ambient sound app with no ads or subscriptions

https://ambisounds.app/
94•alpaca121•10h ago•44 comments

AdapTive-LeArning Speculator System (ATLAS): Faster LLM inference

https://www.together.ai/blog/adaptive-learning-speculator-system-atlas
189•alecco•16h ago•43 comments

Wall Street is worried the private credit bubble will burst

https://www.thetimes.com/business-money/economics/article/wall-street-first-brands-private-credit...
30•zerosizedweasle•1h ago•13 comments

Why are Big Tech companies a threat to human rights?

https://www.amnesty.org/en/latest/news/2025/08/why-are-big-tech-companies-a-threat-to-human-rights/
20•HotGarbage•1h ago•2 comments

The neurons that let us see what isn't there

https://arstechnica.com/science/2025/10/the-neurons-that-let-us-see-what-isnt-there/
31•rbanffy•5d ago•1 comments

oavif: Faster target quality image compression

https://giannirosato.com/blog/post/oavif/
17•computerbuster•8h ago•8 comments

Addictive-like behavioural traits in pet dogs with extreme motivation for toys

https://www.nature.com/articles/s41598-025-18636-0
141•wallflower•8h ago•93 comments

Schleswig-Holstein completes migration to open source email

https://news.itsfoss.com/schleswig-holstein-email-system-migration/
310•sebastian_z•10h ago•102 comments

A years-long Turkish alphabet bug in the Kotlin compiler

https://sam-cooper.medium.com/the-country-that-broke-kotlin-84bdd0afb237
70•Bogdanp•7h ago•71 comments

Loko Scheme: bare metal optimizing Scheme compiler

https://scheme.fail/
146•dTal•5d ago•14 comments

How I'm using Helix editor

https://rushter.com/blog/helix-editor/
180•f311a•9h ago•63 comments

Nostr and ATProto (2024)

https://shreyanjain.net/2024/07/05/nostr-and-atproto.html
114•sph•15h ago•63 comments

Rcyl – a recycled plastic urban bike

https://rcyl.bike/en/the-bike/
25•smartmic•5h ago•24 comments

HP1345A (and wargames) (2017)

https://phk.freebsd.dk/hacks/Wargames/
36•rbanffy•5h ago•2 comments