Last active
February 9, 2018 21:51
-
-
Save JHurricane96/92452a27acb49ebe84a55a3bee46fe3e to your computer and use it in GitHub Desktop.
2nd player code snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------- BB 1 ---------------------------------- | |
for (int i = NUM_SOLDIERS / 2; i < NUM_SOLDIERS; ++i) { | |
//-------------------------------- BB 2 ---------------------------------- | |
auto &soldier = state.soldiers[i]; | |
if (soldier.hp == 0) | |
//-------------------------------- BB 3 ---------------------------------- | |
continue; | |
//-------------------------------- BB 4 ---------------------------------- | |
for (auto enemy_soldier : state.enemy_soldiers) { | |
//-------------------------------- BB 5 ---------------------------------- | |
if (enemy_soldier.hp != 0) { | |
//-------------------------------- BB 6 ---------------------------------- | |
soldier.soldier_target = enemy_soldier.id; | |
break; | |
//-------------------------------- BB 7 ---------------------------------- | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment