Sunday, February 13, 2011

Block Math Part 2

Last week I talked about a system that consists of blocks, block-bags, and arrangements. I introduced two types of arrangements: block-rows, and row-stacks.  Row-stacks can be considered 'clean' if each row contains the same amount of blocks.  I'll introduce a new word for the inverse condition, row-stacks can be said to be 'jagged' if the rows have different quantities.  And one more word 'chipped' for the condition that all the rows are of equal length, except the top one which has less than the rest.  Here's some examples:

clean:

XX
XX

or

XXX
XXX

jagged:

XXXX
X
XXX

or

XX
XXXX
XXXXX

and chipped:

XX
XXX

or

XXX
XXXXXX
XXXXXX

All chipped stacks are also jagged stacks, but not vice-versa.

I'm going to define some operations in abstract terms so that they are more-or-less unambiguous.  The first operation I will call 'sharing'.  Given a clean stack of blocks with a certain amount in each row, you want to share the blocks into an amount of bags equals to the amount of blocks in each row.  Easy right?  You put one block from each row into each bag.  If the stack is clean, you will have an equal number in each bag (since each row contains an equal amount of blocks, therefore each row will have one to offer each bag).  Given a stack of blocks that is chipped, we can use the same process, and each bag will be 'almost equal', that is the difference in the amount of blocks in each bag will be at most a single block.  We can confirm this intuitively by flipping a jagged stack on it's side and observing that each row now only differs by at most a single block from any other row:

XX
XXXX
XXXX

becomes:

XXX
XXX
XX
XX

So now the problem becomes:  given a bag of blocks, form a clean or chipped stack with a certain amount in each row.  We have imagined a row that we can use for a template.  Now we can pull blocks out of the bag and place each block in a row until the amount of the row is equals to the amount in the imagined template row.  At that point we start a new row on top of the old row and repeat the process.  We continue until there are no more blocks left in the bag.  What we will have at the end will be either a clean or a chipped stack.  I will call this operation 'clean-stacking' because we are trying to build a clean stack.

So in order to share the blocks in one bag fairly between a set of bags, we do a clean-stacking operation, and then we do a sharing operation.  This works as long as we define sharing fairly as being that the difference between the amounts in each bag is never greater than a single block.

A new scenario: A block hunt. We have hidden all the blocks from a block-bag around an area, and now we have a certain number of contestants that will find them.  The contestant with the most blocks gets a blue ribbon, the contestant with the most blocks after that gets a red ribbon, and the contestant with the most blocks after that gets a yellow ribbon.  The contestant with the least amount of blocks gets a black ribbon.  How to determine who gets which ribbon?  First, form a jagged stack arrangement by forming a row from each bag and stacking them.  Next form an 'ordered-stack' by finding the longest row in the first stack and placing it in the second stack, then repeat the procedure until the first stack is empty.  As long as you keep track of who belongs to each row, the bottom row will get the blue ribbon, the next row up will get the red ribbon, and the next row up will get the yellow ribbon.  The row at the top gets the black ribbon.  This type of operation is called 'ordering'.  There are actually many variations of this operation, but the one described above is simple, and works well for small stacks.  What to do in case of a tie?  Actually, it doesn't matter, since we made up the rules of this game we can make up the rules arbitrarily for tie cases, and as long as all contestants agree to the rules, and the rules don't change during the course of the contest, it should be considered fair.

One more arrangement, is actually a pair arrangement.  Given a clean stack of blocks, form a partner clean stack with the same amount of rows.  The amount of blocks in the rows of the two stacks can differ, as long as they are the same in each stack.  For example:

XX   XXXX
XX   XXXX
XX   XXXX

If we add or remove rows from both sides, we can see that the total amount in each stack grows or shrinks relative to each other.  So I will call these stacks relative-stacks.  When would you need to have relative-stacks?  Here's a scenario:  You're dining out, and the waiter is very prompt and friendly.  You know he probably only earns a small salary, and you want to reward him extra for his good service.  How do you determine what is a fair amount?  You could just give him some fixed amount, or you could consider that the amount of effort that he spent is somewhat relative to the size of the bill you receive at the end of the meal.  In order to be fair and reward him relative to his effort, we can make a pair of relative-stacks, the first being the a stack made from blocks equal to the number of dollars in the bill, and the second being a partner in the relative stacks.  The number of rows in each of the partner stacks is some arbitrary amount that has been determined by good-manners experts as producing a fair amount.  So first we do a 'clean-stacking' operation for the first stack based on a block-bag equals to the amount of dollars in the bill, and the we do a 'clean-stacking' operation from our reserve block-bag but stop when the stack amounts of the stacks are equal.  We give the waiter an amount of dollars equal to the amount of blocks in the partner stack.  So for example:

XXXXXXXXXX   X
XXXXXXXXXX   X

The stack to the left represents the dollars in the bill, and the stack to the right represents the dollars in the tip. This way we ensure that for a larger bill, we give a larger tip, since we consider the bill to be relative to the amount of effort the waiter made, and wish to reward him fairly.  The amount in each stack is somewhat arbitrary, except that the bill stack will tend to have many more than the tip stack and the amounts should be consistent across time.

So what happens if when you are doing the 'clean-stacking' operation, you come up with a chipped stack?  You could do a number of things, you could form the partner stack based on the amount of full row stacks, or based on the amount of stacks full or not.  Or we could introduce a new term 'mid-way'  If the amount of block in the top row is greater than mid-way, you would base it on the total amount of all stacks.  If the amount of blocks in the top row is less than mid-way, you would base it on the amount stacks of only full rows.  If the amount of blocks in the top row is exactly mid way, you would have to find some random way of determining what to use.  Next week I will better define the term mid-way and why it might produce a more-fair relative stack.

No comments:

Post a Comment