'Refactored by Sourcery'

This commit is contained in:
Sourcery AI
2023-05-24 23:55:27 +00:00
committed by amjad
parent 7c1e336f14
commit 71d02673a9
70 changed files with 582 additions and 835 deletions

View File

@@ -153,11 +153,8 @@ def computer_pick(
q = pile_size - 1 if win_option == WinOptions.AvoidLast else pile_size
c = min_select + max_select
computer_pick = q - (c * int(q / c))
if computer_pick < min_select:
computer_pick = min_select
if computer_pick > max_select:
computer_pick = max_select
return computer_pick
computer_pick = max(computer_pick, min_select)
return min(computer_pick, max_select)
def computer_move(
@@ -184,7 +181,7 @@ def computer_move(
# Otherwise, we determine how many the computer selects
curr_sel = computer_pick(pile_size, min_select, max_select, win_option)
pile_size = pile_size - curr_sel
pile_size -= curr_sel
print(f"COMPUTER TAKES {curr_sel} AND LEAVES {pile_size}")
return (False, pile_size)