** This question involves knowledge of computer programming and/or math and algorithms. **
I am working on writing a Warhammer combat simulator in Java and have hit an interesting snag.
Pg 20 BRB: "Once the charging unit contacts the enemy unit, it must perform a second, bonus wheel if required to bring its front facing into flush contact with the facing of the enemy unit that has been charged, maximizing the number of models in base contact on both sides"
Aligning the units in this way is absurdly simple when looking at them, but trying to write the code to do the same thing is proving difficult. I tried posting the question to Stack Overflow, but I think the concept is too vague.
Basically, I'm trying to simulate combat between a unit of spearmen (20x20mm bases) and a unit of horsemen (25x50mm bases), and programatically determine how many models will get attacks during the combat.
Any help would be appreciated.