Skip to content

Commit

Permalink
Refactored by Sourcery
Browse files Browse the repository at this point in the history
  • Loading branch information
SourceryAI committed Jun 1, 2020
1 parent c7f3afd commit f7ca7c1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def do_fight(attacker_ship_die, defender_ship_die, attacker_cards, defender_card
cards=defender_cards,
)

res = attacker.attack(defender)
return res
return attacker.attack(defender)


def do_battle_win_any(fights, attacker_cards, defender_cards):
Expand Down Expand Up @@ -118,8 +117,7 @@ def main():

# TODO: parse 1to6
def parse_fights(fights_str):
fights = [[int(die) for die in fs.split(":")] for fs in fights_str]
return fights
return [[int(die) for die in fs.split(":")] for fs in fights_str]


def parse_args():
Expand Down
6 changes: 3 additions & 3 deletions quantum_nologs.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def attack(self, defender):
winner, loser = self.recalc(attacker, defender)

# If the LOSER holds Cruel, they can force the WINNER to re-roll
# We assume that they will ALWAYS do this, and that the LOSER will
# never do this
# We assume that they will ALWAYS do this, and that the LOSER will
# never do this
if "cruel" in loser.cards:
prev_winner = winner
winner.roll()
prev_winner.roll()
winner, loser = self.recalc(attacker, defender)

# If the DEFENDER holds Stubborn, then they break ties
Expand Down
3 changes: 1 addition & 2 deletions rolls/management/commands/qq.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def die_face(die):


def parse_fights(fights_str):
fights = [[die_face(die) for die in fs.split(":")] for fs in fights_str]
return fights
return [[die_face(die) for die in fs.split(":")] for fs in fights_str]


def battle_summary(fights, attacker_cards, defender_cards, win_condition):
Expand Down
2 changes: 1 addition & 1 deletion table.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_possible_hands(available_cards=None):
available_cards = CARDS
return [
hand
for num_cards in range(0, 4)
for num_cards in range(4)
for hand in itertools.combinations(available_cards, num_cards)
]

Expand Down

0 comments on commit f7ca7c1

Please sign in to comment.