MRGG

Pseudo-code for Algorithm 2:
------------------------------------
(Begin)
Impossible, Four opponents

Generate random integer from 1 to 4
If 1 then small land size
If 2 then medium land size
If 3 then large land size
If 4 then huge land size

Generate random integer from 1 to 5
If 1 then 0.5x magic
If 2 then 1x magic
If 3 then 1.5x magic
If 4 then 2x magic
If 5 then 2.5x magic

Generate a random integer from 1 to 14, which determines picture. (e.g. Raven is #2)

Generate random integer from 1 to 4.
If 1, 2, or 3 then go to Option 1
If 4 then go to Option 2

Option 1. [Book favor]
Spend Picks:
If there are 0 picks to spend, go to Remove Default Selection of Spells.
Generate random integer from 1 to 2
If 1 then go to Pick a Skill
If 2 then go to Pick Books

Pick a Skill:
Generate random integer from 1 to # of skills not already check marked [initially 18]. (Each skill has equal chance of being selected. Even gray skills can be selected).
Select the skill that was given by random integer (e.g. Warlord is #2). If it is not selectable then select minimum number of books to make the skill happen.
If there is more than 1 way to select minimum number of books, then generate random integer to select book color then select minimum number of books to make skill happen.
Repeat selection of color if necessary, but do not exceed minimum support for skill. 
If divine power was rolled, but there is already a death book, then add infernal power. If that is impossible, then go to Spend Picks. 
If infernal power was rolled, but there is already a life book, then add divine power. If that is impossible, then go to Spend Picks. 
If the rolled skill is too expensive to make it happen then reroll [this is a time saver, not requiring you to find out which skills are already impossible].
Once a skill is selected, go to Spend Picks. If it is impossible to pick any skill, go to Pick Books.

Pick Books:
Generate random integer from 1 to 5. This determines what color of books you will choose next.
If death was rolled, but there is already a life book, then consider this roll life.
If life was rolled, but there is already a death book, then consider this roll death.
Generate random integer from 1 to maximum number of picks available. Select # of books in color given by the integer. Go to Spend Picks.

Option 2. [Skill favor]
Generate a random integer from 1 to # of (unchecked skills + 5) [initially 23, 1-18 corresponds to individual skills, 19-23 to individual books in each of the 5 colors].
A random integer represents a skill or a single book in one of 5 colors.
If death was rolled, but there is already a life book, then consider this roll life. If life was rolled, but there is already a death book, then consider this roll death.
If a skill is not selectable then select minimum prerequisites to make the skill happen.
If there are more than 1 ways to select prerequisites then generate random integer to select color then select minimum number of books to make skill happen.
Repeat selection of color if necessary, but do not exceed minimum support for skill. 
If divine power was rolled, but there is already a death book, then add infernal power. If that is impossible, then go to Option 2. 
If infernal power was rolled, but there is already a life book, then add divine power. If that is impossible, then go to Option 2. 
If the rolled skill is too expensive to make it happen then reroll. If there are more picks to spend then go to Option 2.

Remove Default Selection of Spells.

Select Spells.
Generate random integer from 1 to # of unchecked spells at lowest rarity level (first time: 1 to 10). Select spell that corresponds to random integer [first column is 1 to 5].
If more spells can be selected then go to Select Spells.

Select Race.
If not Myrran then generate random integer from 1 to 9. Select race that corresponds to random integer.
If Myrran then generate random integer from 1 to 14. Select race that corresponds to random integer.

Select Color. 
Generate random integer from 1 to 5. Select color that corresponds to random integer.
(End)