/OddsVsEvens

The odds are even in this war of mine

Primary LanguagePHP

The odds are even in this war of mine

The struggle between the odd and even soldiers has never been so fierce! Each battle will see even and odd soldiers thrown in together, all of them integers. The odd soldiers in the battlefield will fight using the 1 bits from their binary representation, while the even soldiers will fight using their ​ 0 bits. If present in the battle, soldiers with the number 0 will be neutral, hence they will not be fighting for either side. But beware - there are also spies and saboteurs - each soldier that wears negative sign can have a negative effect on the battle’s result.

Rules:

odds win ​ - if the number of ​ 1s from odd soldiers is larger than the number of 0s from even soldiers
evens win ​ - if the number of ​ 1s from odd soldiers is smaller than the number of 0s from even soldiers
tie​ - if there is an equal number of 1s and ​ 0s or when the battlefield is completely empty