Main      Site Guide    
Message Forum
Inventory Arrangement Problem
Posted By: gremlinn, on host 24.25.222.220
Date: Thursday, December 21, 2000, at 14:34:13

A question that Sam posed to me a while back: what is the largest number of items a player can have in an AGL game such that the table of items fits in four columns?

As you might notice, the inventory table never uses more than 5 columns, whereas the number of rows can be fairly large (up to 24, I believe, since you can have at most 120 items). Here is the algorithm that is used to determine the layout of the table, supposing the number of items is N:

1. Determine the smallest number of rows that must be used to fit all of the items into a table. [This will just be N/5, rounded up to the nearest integer.] Call this number R.

2. Place items 1 through R down the first column, (R+1) through 2R down the second column, etc., until you are out of items. Since you are cramming the maximum number of items into each column, you are also mimimizing the total number of columns given R rows.

Sometimes all 5 columns end up being used, but not always. So the challenge is to find the largest number of items you can have that uses at most 4 columns, and prove it.

If you can do that, try proving the general case, where the maximum number of columns is some value C (C>1).

--gremlinn

Replies To This Message