Frank Gordon
Frank Gordon

Reputation: 91

Calculating all possible combinations

I'm trying to calculate the number of possible combinations of clothing for different types of characters in a game as well as listing those combinations or a PHP script to generate the filenames.

I have 5 different type of characters (mexican, asian, american, african).

There are 3 different sizes for each character (small, medium, large)

There are 9 different sets of clothing (shirt, shorts, shoes).

The gear are grouped into the following order:

Shirt (A) | X1  X2  X3 | Y1  Y2  Y3 | Z1 Z2 Z3
Short (B) | X1  X2  X3 | Y1  Y2  Y3 | Z1 Z2 Z3
Shoes (C) | X1  X2  X3 | Y1  Y2  Y3 | Z1 Z2 Z3

Small is X1 - X3, Medium is Y1 -Y3, Large is Z1 - Z3

You have to unlock each type of clothing in sequential order before the next one.

Each group (X, Y, Z) must have all items unlocked before moving forward.

Upvotes: 0

Views: 577

Answers (1)

John D. Cook
John D. Cook

Reputation: 30089

For algorithms for producing all combinations, see Knuth The Art of Computer Programming, Volume 4, Fascicle 3: Generating All Combinations and Partitions

Upvotes: 1

Related Questions