Permutations: Upgrades and Downgrades

28 Views Asked by At

I'm working on a game. In the game, all the pieces have stats, like "Strength", "Smarts", "Skill" etc. Any of these stats might be above or below the baseline.

I want to work out how many permutations of stats I can have if I've settled on the following rules to make each piece interesting:

  1. Each piece starts with baseline stats.
  2. Each piece gets a +1 to one of its baseline stats, twice. These can both be to the same stat, or different stats.
  3. Each piece gets a -1 to one of its baseline stats. The stat chosen cannot be one that received a bonus.

For example, say that my game has six stats: Strength, Brains, Skill, Charm, Will, and Speed All start at a baseline rating of "1"

According to my rules, it would be legal to have a game piece with the following stats:

Strength: 2, Brains: 2, Skill: 1, Charm: 1, Will: 0, Speed: 1 or Strength: 3, Brains: 1, Skill: 0, Charm: 1, Will: 1, Speed: 1

...but it would be boring and therefore illegal, to have a game piece whose penalty cancelled out a bonus, leaving it with stats that looked like:

Strength: 2, Brains: 1, Skill: 1, Charm: 1, Will: 1, Speed: 1

Now I know basic permutations. I know that if none of the three bonuses or penalties could overlap, then I'd have a simple 6 choose 3 permutations. And if there were no restrictions on permutations, I would have 6^3 possible ways of awarding the bonuses & penalties, though only 156 unique statlines as a result.

Now I can hand compute the number of permutations for my example. (90). What I'd really like is a generalized equation for the number of permutations my stat rules generate if the number of stats changes. Also if the number of upgrades each piece gets changes from 2 to a different number of upgrades.