Area Majority Game - How to evaluate most and second most?

I have an area majority game where X points are given to the side with the most forces in a region, and Y points are given to the side with second most units in a region, etc. If there is a tie, then both sides get the points.

Doing this in a 2-sided game is damn simple. But this game has 7 players. Is there any way short of super convoluted nested “If” statements to properly evaluate who has the ‘most’ in an area?

My plan was to use the ‘on move’ command to adjust a variable to denote the number of each side’s forces in a given area (so 7 variables per area) and then fire a command to somehow update the display showing who has the ‘most’ and who has the ‘second most’. I just can’t figure out how to evaluate that to properly display the correct side.

Unfortunately, I can’t think of any easy way to do that with VASSAL; even a simple Bubble sort is rather difficult to implement with a BeanShell expression. Hate to tell you this, but it would probably be best to write a bit of custom Java code to sort the scores.

If you wanted to look at the All Bridges Burning module (the new COIN game), it handles many of these issues. You can look in particular for the “Countable” prototype (no custom code needed)