# Algorithm

Let's face it, if you play Warhammer, you are a geeky person who loves puzzles, numbers, and complexity in general. You are interested in how things work, not just in using them. This page is for you.

While this isn't a perfect replica of the algorithm, it should help give you an idea of what is happening. If you have any suggestions on improvements, please leave feedback through the button at the top of the page.

Step 1: Pick a random Lord or Hero (to make sure there is a general)

Step 2: Pick a random unit from core till the generated army value is greater than 25% of the desired point value + the value of the Lord or Hero that was chosen (e.g., if you tell it to do a 1000 point army, and it picks a hero for 100 points, the algorithm will keep picking from core till the generated army value is at least 350 points)

Step 3: Pick a random unit from any category (Lord, Hero, Core, Special, Rare) within army rules till the generated army point value is within 50 points of the target point value

So the way that step 3 is set up, the algorithm disproportionately picks from both characters and core. I have thought about weighting step 3 to more likely pick from special and rare, but I am not sure yet. Any thoughts on this matter would be great.

While I am on the subject of tweaks to the algorithm... the algorithm is also has a predisposition to pick large units over small units as it 1) picks a random unit from the army list, 2) gets the minimum size of the unit and the maximum size (either a limit by the army book or the number of models that the user has that the algorithm hasn't already used), then 3) pick a random number between the min size and the max size. For example, if you have 80 Glade Guard models, the first time the algorithm randomly picks to add a Glade Guard unit, it is going to pick a random number between 10 and 80 inclusive. What, if any, would be a better way to pick unit sizes. Keep in mind that the algorithm should be the same for all armies, so good unit size for Wood Elves may be a terrible unit size for Skaven.