Spielerando

Refilling a lantern from half-empty oil flasks without wasting a drop

Players collect flasks with odd amounts and the lantern holds only so much. Naive code either throws the overflow away, takes a whole flask for a sip, or refuses to pour at all. Here is how to pour so that nothing is lost and the pack stays tidy.

Why this works

Whatever the player has gathered should never vanish through the rules of pouring. Moving exactly what fits, and leaving the rest in the flask, keeps every drop accounted for, and emptying the smallest flasks first leaves the pack tidy.

When not to use it

Not needed when the lantern simply refills by itself or the oil comes in one size, such as a single can that tops it up. Then pouring by amounts is a chore, so offer a one-press refill.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 23 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Refilling a lantern from half-empty oil flasks without wasting a drop" (read_entry narr-lantern-oil-flask-refill) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP