COLLUSIONI.ST

Tricky (for me) Math Problem

February 14, 2006

So I’m trying to tidy up a few things with llor.nu, and one of them is my square distribution/balancer called the Square doler. It doles out new squares when needed, and it’s never been right. I’ve spent many many hours trying to figure out how to do it right, and I’ve essentially given up. I present to you, humble and mathematically smarter, humans a problem.


First, here’s what you have, for those unfamiliar with the game.


The game “board” is an infinite loop of distinct squares that needs to grow based on some kind of trigger. The trigger may not be relevant, but right now, new squares are added (if needed) when a player buys a building. Building buying happens somewhat frequently, so this is a good way of keeping things in check. But this isn’t the problem.


You also have several different square types. You have buyable squares, squares that have a building on them, convenience store squares, bank squares, and completely empty squares. A game will be setup so that at any given time, a specific percentage of each square type will exist.


So you might get a break down like 75% buyable, 15% stores, 5% empty, 5% banks. And this is where the problem begins. When a player buys a building, it changes the total square count. So, given the right amount of total squares, 75% buyable squares might turn into 74% buyable squares, which would trigger the doler to create a new buyable square or two, enough to meet the desired 75% of total squares.


So, here’s what you know at any given moment:


What’s not known:


Hopefully I’m just numb to the solution and it’s easy. Ask me question through AIM at elbowdonkey if needed.


Update

This is but one of the things I’m thinking about on Valentine’s day, thank you very much.


Clarifications


Ultimately the idea is to make sure that when a person rolls the dice, their odds of landing on any particular type of square remain generally equal to the desired percentages of each type. I say generally, because I understand that getting the two to align isn’t easy. But it’s fine if it sways a few percentage points from roll to roll.