In Part 3 of this series we calculated the number of possible Summoner Wars decks we can build for each faction when using reinforcements (but still not using Mercenaries). The numbers were impressive: in the tens of thousands for most factions -- 32,788 to 66,960 to be precise. But the Mercenaries, which have about three times the number of units, have an astonishing 7,868,950,752 different decks, which only shows how explosively the number of combinations can grow.

The title for that part said “Unlimited Reinforcements”, meaning we had enough copies of the sets to have up to the legal limit of 10 copies of any card. However, most of us are not in that position. I would really *like* to eventually own two of each product, but for now I am content with one of each. For those of us who have only one of each — one Starter Set and one Reinforcement Pack — how many different decks are possible to build?

We do our counting based on the same principles, of course: we start with the basic number of combinations, and subtract the number of illegal combinations. Now, instead of using 10 as the limit from the rules, we use the limit of the number of cards in the boxes, which for the Tundra Orcs is 8 Fighters and 5 each of every other Common.

- Fig. 1. A deck with too many Thwarters and too many Chargers

But now a new problem crops up. The combination shown in Figure 1 above is disallowed for two different reasons: it has 6 Thwarters and 8 Chargers, when we only have 5 of each in the box. We did not see something like this before, because we cannot have more than 10 copies of two different kinds of Units when there is a total limit of 18 Commons. Using the methods we have used so far, this combination will get subtracted twice, and give us an inaccurate result. It’s time to pull out another tool from the combinatorial toolbox.

## Including and Excluding

In Figure 2 we see an abstract representation of the situation, using good old Venn diagrams. There are 20 objects shown as triangles, and objects inside any of the circles have the property represented by the circle. In our case, the property is having too many of a kind of Common, so we want to know the number of objects that are not inside any circle. In the small sample size of the figure we can count the triangles visually, but in our case there are potentially hundreds or thousands of objects, and we have no good way to count things *outside* of regions, so we have to count things *inside* of regions and subtract.

In Fig. 2a we subtract the objects in circle A from the total:

num(Total) – num(A) = 20 – 7 = 13

So far so good. But look what happens when we try it in Fig. 2b, and also subtract the number of objects in circle B:

num(Total) – num(A) **- num(B)** = 20 – 7 **- 8** = 5

This is too low — there are actually 8 objects outside of both circles. The problem is, we subtracted the objects in the intersection of A and B twice. So we need to add back in the number of objects in the intersection:

num(Total) – num(A) – num(B) **+ num(A&B)** = 20 – 7 – 8 **+ 3** = 8

and the problem is solved. So let’s do the same in Fig. 6c where we have 3 circles:

num(Total) – num(A) – num(B) **- num(C)** + num(A&B) **+ num(A&C) + num(B&C)**

= 20 – 7 – 8 **- 7** + 3 **+ 2 + 5** = 8

Now the total is too large — there are only 6 objects outside of all circles. This time the problem is that we counted the intersection of all 3 circles three times, so we need to subtract it back out:

num(Total) – num(A) – num(B) – num(C) + num(A&B) + num(A&C) + num(B&C) **- num(A&B&C)**

= 20 – 7 – 8 – 7 + 3 + 2 + 5 **- 2** = 6

This is the ** Principle of Inclusion and Exclusion**. To get the number of objects with none of a given set of properties,

- Take the total number of objects.
- For each property,
**subtract**the number of objects with that property. - For each pair of properties,
**add**the number of objects having both properties. - For each set of 3 properties,
**subtract**the number of objects having all 3 properties. - For each set of 4 properties,
**add**the number of objects having all 4 properties. - Etc., until reaching the number of properties you are dealing with.

Fortunately, we can stop after step 2, since it is not possible to have a deck with too many of 3 different kinds of Commons. (We have at most 15 empty slots, and with at least 5 copies of nearly all Commons, fitting 3 groups of 6 Commons into those 15 slots just can’t happen.)

So, let’s go back and recalculate!

## Redoing the Math

As before, the basic number of Tundra Orc Common combinations is

C( 14+(5-1), (5-1) ) = C( 18, 4 ) = 18*17*16*15 / 4*3*2*1 = 3060

C( 7+(5-1), (5-1) ) = C( 11, 4 ) = 11*10*9*8 / 4*3*2*1 = 330

For Shamans and Smashers, we get 5 each, with 1 on the board, so we need 5 more to make too many, leaving 9 empty slots (Fig. 3):

C( 9+(5-1), (5-1) ) = C( 13, 4 ) = 13*12*11*10 / 4*3*2*1 = 715

For Thwarters and Chargers, we have 5 each with none in the setup, so we need 6 more to make too many, leaving 8 empty slots:

C( 8+(5-1), (5-1) ) = C( 12, 4 ) = 12*11*10*9 / 4*3*2*1 = 495

Now for the decks with too much of two kinds of Commons. Let’s make a list:

- Fighters and Shamans: 7+5=12 extra Commons, leaving 2 empty slots. C( 2+4, 4 ) = C( 6,4 ) = 15
- Fighters and Smashers: 7+5 again, C( 6,4 ) = 15
- Fighters and Thwarters: 7+6 = 13, 1 empty slot. C( 1+4,4 ) = 5
- Fighters and Chargers: 7+6 again, C( 5,4 ) = 5
- Shamans and Smashers: 5+5=10, 4 empty slots, C( 4+4,4 ) = C( 8,4 ) = 70
- Shamans and Thwarters (Fig. 4): 5+6=11, 3 empty slots, C( 7,4 ) = 35
- Shamans and Chargers: 5+6=11 again; 35
- Smashers and Thwarters: 5+6 yet again; 35
- Smashers and Chargers: ditto; 35
- Thwarters and Chargers: 6+6=12, 2 empty slots, C( 6,4 ) = 15

Totaling it all up:

3060 – (330+715+715+495+495) + (15+15+5+5+70+35+35+35+35+15)

= 3060 – 2750 + 265 = **575**

575 is substantially smaller than the 2724 Common combinations we get when we can have up to 10 copies of any Common.

Doing similar calculations for all the factions with reinforcements, we get:

Faction Champ Comb Common Comb Total Comb Tundra Orcs 20 57511500Phoenix Elves 20 59511900Cave Goblins 20 4639260Guild Dwarves 20 4979940Vanguard 20 54010800Fallen Kingdom 4 368114724Jungle Elves 4 284611384Cloaks 20 51510300Benders 20 59511900Sand Goblins 20 54010800Deep Dwarves 20 54010800Shadow Elves 20 4639260Mountain Vargath 20 57511500Swamp Orcs 20 57513020Total157088

On average, this is about one fourth of the unlimited combinations we saw in Part 3.

## Limited Mercenaries

Finally, we’ll recalculate the current Mercenary possibilities. As before, we start with the total number of ways of picking 14 cards from 9 piles, which is

C( 14+(13-1), 13-1 ) = C( 22, 12 ) = **9,657,700**

Now we subtract those with too many of one kind of Common. Of the Commons in the Faction Deck,

- There are 7 Apprentice Mages, 1 in the setup, so 7 more will be too many, leaving 7 empty slots.
- There are 6 Stone Golems, 2 in setup, so 5 more are too many, leaving 9 empty slots.
- There are 5 Rune Mages, 1 in setup, so 5 more are too many, again leaving 9 empty slots.
- All the 6 other Merc Commons have 5 in the Reinforcement Pack, so 6 is too many, leaving 8 empty slots.

Correspondingly,

C( 7+(13-1), 13-1 ) = C( 19, 12 ) = 50,388

2 * C( 9+(13-1), 13-1 ) = 2 * C( 21, 12 ) = 2 * 293,930 = 587,860

6 * C( 8+(13-1), 13-1 ) = 6 * C( 20, 12 ) = 10 * 125,970 = 1,259,700

50,388 + 587,860 + 77220 = **1,897,948**

Finally, we have to add in selections with too many of two different kinds of Mercenary Commons:

- Apprentice Mages with any of the 10 Reinforcement Pack Mercenary Commons requires 7+6=13 cards, leaving 1 free slot. There are 10 such pairings.
- Apprentice Mages with either Golems or Rune Mages requires 7+5=12 cards to make too many, leaving 2 free slots. Also, any 2 of the 10 Reinforcement Pack Merc Commons require 6+6=12 cards, leaving 2 free slots, as in #1 above. “Any 2 of the 10″ is C(10,2)=45 ways of doing that, which with the other two makes 47 pairs with 2 free slots.
- Either Golems or Rune Mages with any of the 10 Reinforcement Commons requires 5+6=11 cards, leaving 3 free slots. 2*10=20 of these
- Golems and Rune Mages taken together require 5+5=10 slots, leaving 4 free ones. Just one of these.
- Just as a check, the number of pairings of 13 kinds of MR Commons is C(13,2) = 78, and 10+47+20+1=78, so we have accounted for all pairings.

10 * C( 1+(13-1), 13-1 ) = 10 * C( 13, 12 ) = 10 * 13 = 130

47 * C( 2+(13-1), 13-1 ) = 47 * C( 14, 12 ) = 47 * 91 = 4277

20 * C( 3+(13-1), 13-1 ) = 20 * C( 15, 12 ) = 20 * 455 = 9100

1 * C( 4+(13-1), 13-1 ) = C( 16, 12 ) = 1 * 1820 = 1820

130 + 4277 + 9100 + 1820 = **15,327**

Putting it all together, and multiplying times the number of Champion combinations:

9,657,700 – 1,897,948 + 15,327** **= **7,775,079**

816 * 7,775,079 = **6,344,464,464**

Interestingly, this is around 80% of the unlimited possibilities calculated last time, a much higher percentage than the 25% of the other factions. Why? I can only speculate that having so many different kinds of Commons to choose from makes them not as strongly affected by the limitations to the number of each kind.

Next time, we’ll see what happens when we add Mercenaries to the other factions!

## worlds_enemy commented:

My brain hurtsPosted on 2012-10-05.