in reply to army building

That is the classic knapsack problem. It can be approached by recognising and keeping partial solutions, adding one item a time.

Given a list of records for available players, each single item whose weight is less that the total allowed is a solution. From those solutions, build a tree-like structure containing items that can be added without exceeding the allowed total.

After Compline,
Zaxo