Created
July 12, 2012 00:40
-
-
Save andrewheiss/3094757 to your computer and use it in GitHub Desktop.
Excerpt from basic algorithm
This file contains hidden or 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
def a_ask_b_to_join(): | |
print "Inviting B" | |
if b_delta_if_move >= 0 and b_delta_if_move > b_delta_if_stay: | |
print "This is the ideal situation; {0} will gain {1} points and {2} will gain {3}. Permission granted.".format(player_a.name, a_delta_if_stay, player_b.name, b_delta_if_move) | |
player_b.joinTeam(team_a) | |
return True | |
elif b_delta_if_stay >= 0 and b_delta_if_stay > b_delta_if_move: | |
print "It's better if B stays... but why not... join!" # TODO: Maybe base this on a percentage? | |
player_b.joinTeam(team_a) | |
return True | |
elif b_delta_if_move == b_delta_if_stay and b_delta_if_move > 0: | |
print "It doesn't matter to B. Permission granted." | |
player_b.joinTeam(team_a) | |
return True | |
else: | |
print "Permission denied" | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment