Spielerando

Split a stack in half and merge it back when dragging items

Dragging half a stack sounds simple until a stack of seven needs splitting, a full stack receives more, or two different items are dropped on each other. This entry covers the rounding, the leftovers and the cases where nothing may happen.

Why this works

Moving items should never change how many exist. Each action only shifts a count from one place to another, and rounding in the player's favour on the half they pick up means a stack of one still behaves sensibly.

When not to use it

Do not offer free splitting for items that carry their own wear, charges or marks. Halving them would either copy or lose the extra details. Treat such items as single pieces and move them whole.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 24 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 "Split a stack in half and merge it back when dragging items" (read_entry split-and-merge-stacks-by-dragging) 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