question: private static float strength ( final Collection < Unit > units , final boolean attacking , final boolean sea , final boolean transportsFirst ) { float strength = 0.0F ; if ( units . isEmpty ( ) ) { return strength ; } if ( attacking && Match . noneMatch ( units , Matches . unitHasAttackValueOfAtLeast ( 1 ) ) ) { return strength ; } else if ( ! attacking && Match . noneMatch ( units , Matches . unitHasDefendValueOfAtLeast ( 1 ) ) ) { return strength ; } for ( final Unit u : units ) { final UnitAttachment unitAttachment = UnitAttachment . get ( u . getType ( ) ) ; if ( unitAttachment . getIsInfrastructure ( ) ) { continue ; } else if ( unitAttachment . getIsSea ( ) == sea ) { final int unitAttack = unitAttachment . getAttack ( u . getOwner ( ) ) ; strength += 1.00F ; if ( attacking ) { strength += unitAttack * unitAttachment . getHitPoints ( ) ; } else { strength += unitAttachment . getDefense ( u . getOwner ( ) ) * unitAttachment . getHitPoints ( ) ; } if ( attacking ) { if ( unitAttack == 0 ) { strength -= 0.50F ; } } if ( unitAttack == 0 && unitAttachment . getTransportCapacity ( ) > 0 && ! transportsFirst ) { strength -= 0.50F ; } } else if ( unitAttachment . getIsAir ( ) == sea ) { strength += 1.00F ; if ( attacking ) { strength += unitAttachment . getAttack ( u . getOwner ( ) ) * unitAttachment . getAttackRolls ( u . getOwner ( ) ) ; } else { strength += unitAttachment . getDefense ( u . getOwner ( ) ) ; } } } if ( attacking && ! sea ) { final int art = Match . countMatches ( units , Matches . UnitIsArtillery ) ; final int artSupport = Match . countMatches ( units , Matches . UnitIsArtillerySupportable ) ; strength += Math . min ( art , artSupport ) ; } return strength ; }
target:  Get a quick and dirty estimate of the strength of some units in a battle.