Thread:FixSRwiki/@comment-46261745-20201103224858/@comment-46261745-20201104011604

Have you looked at the enemy troop distribution templates before, btw? It's kind of interesting to see how AliceSoft nudges the AI towards using certain combos (granted, it's only in 25% of battles, and the AI only chooses 1 of these at random, and skips over the whole section if the don't have the required troops):

1 foot soldier in each row

2 warriors + footsoldier in front row

1 footsoldier in front, 3 archers in the back

2 ninja in the front, 1 ninja in the back

1 warrior + 1 foot soldier in the front, 1 miko + 1 tactician in the back

1 footsoldier + 1 warrior + 1 ninja in the front, 1 tactician + 1 archer in the back

2 warriors in the front, 1 miko in the back

1 foot soldier in the front, 3 ninja in the back

1 footsoldier in each row + 2 diviners in the back

2 footsoldiers in the front, 3 diviners in the back

1 tactician in the back

I'm not entirely sure why they chose these arrangements specifically, but seems like something we could easily add to or modify.

Note that when it does not use a template, or even after using a template, it will loop through any empty positions and add commanders at random to fill those spots up.

It evalutes whether or not to actually assign that random commander in a rather complex fashion that essentially comes down to higher chance if a) the troop is healthy, b) it's the last territory to conquer a kuni or c) incremental chance for each subsequent empty spot it tries to fill

Note that all this is near the bottom of 敵ＦＰ登録