I am not quite sure what you mean, but the algorithm i am using is very clever, and you could easily change it to use for instance pikemen in the first row and archers in the second, etc. It builds from the center and outwards, and then adds a new rank once maximum width is exceeded, i can show you how it works if you want.