Spielerando

Fix a prize wheel that picks wrong items or shows chances that do not add up to 100

A prize with weight zero still comes up now and then, the last prize is never drawn, or the chances on screen add up to 99 or 101. Each is a small slip in how a random number is turned into a pick. This entry shows how to make the AI draw and display chances correctly.

Why this works

A draw is a ruler laid out in segments, and a random point lands on one of them. If each segment is exactly as long as its weight, and the end of each segment belongs to the next one, every prize gets precisely its share.

When not to use it

Skip it if the prizes must be handed out evenly over a fixed number of turns, such as one of each in a bag. There random picks can repeat or miss an item, so draw without putting back instead.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 35 lines of example code with 5 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Fix a prize wheel that picks wrong items or shows chances that do not add up to 100" (read_entry weighted-prize-pick-and-shown-percentages) 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