Skip to content

Commit b4b188b

Browse files
committed
Black-en all files
1 parent 6f10b8f commit b4b188b

28 files changed

Lines changed: 96 additions & 93 deletions

File tree

01_Acey_Ducey/python/acey_ducey.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import random
88

9-
109
cards = {
1110
2: "2",
1211
3: "3",
@@ -32,7 +31,7 @@ def play_game() -> None:
3231
round_cards = list(cards.keys()) # gather cards from dictionary
3332
card_a = random.choice(round_cards) # choose a card
3433
card_b = card_a # clone the first card, so we avoid the same number for the second card
35-
while (card_a == card_b): # if the cards are the same, choose another card
34+
while card_a == card_b: # if the cards are the same, choose another card
3635
card_b = random.choice(round_cards)
3736
card_c = random.choice(round_cards) # choose last card
3837
if card_a > card_b: # swap cards if card_a is greater than card_b

03_Animal/python/animal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ def main() -> None:
131131
# Main loop of game
132132
print_intro()
133133
while (
134-
keep_playing := parse_input(
135-
"Are you thinking of an animal? ", True, root
136-
)
134+
keep_playing := parse_input("Are you thinking of an animal? ", True, root)
137135
== "y"
138136
):
139137
keep_asking = True
@@ -170,7 +168,9 @@ def main() -> None:
170168
f"for a {new_animal} the answer would be: ", False, None
171169
)
172170

173-
actual_node.update_node(f"{new_question}?", answer_new_question, new_animal)
171+
actual_node.update_node(
172+
f"{new_question}?", answer_new_question, new_animal
173+
)
174174

175175
else:
176176
print("Why not try another animal?")

05_Bagels/python/bagels.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
Python port by Jeff Jetton, 2019
3030
"""
3131

32-
3332
import random
3433
from typing import List
3534

07_Basketball/python/basketball.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ def dartmouth_jump_shot(self) -> None:
128128
self.opponent_ball()
129129
elif random.random() > 0.5:
130130
print(
131-
"Shot is blocked. Ball controlled by "
132-
+ self.opponent
133-
+ ".\n"
131+
"Shot is blocked. Ball controlled by " + self.opponent + ".\n"
134132
)
135133
self.opponent_ball()
136134
else:

10_Blackjack/python/blackjack.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,9 @@ def hand_as_string(self, hide_dealer: bool) -> str:
167167
"""
168168
if hide_dealer and self.player_type == PlayerType.Dealer:
169169
return "".join(f"{c.name}\t" for c in self.hand.cards[1::-1])
170-
elif (
171-
hide_dealer
172-
and self.player_type == PlayerType.Player
173-
or not hide_dealer
174-
):
170+
elif hide_dealer and self.player_type == PlayerType.Player or not hide_dealer:
175171
s = "".join(
176-
f"{cards_in_hand.name}\t"
177-
for cards_in_hand in self.hand.cards[::-1]
172+
f"{cards_in_hand.name}\t" for cards_in_hand in self.hand.cards[::-1]
178173
)
179174
s += f"total points = {self.hand.get_total()}"
180175
return s

12_Bombs_Away/python/bombs_away.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Ported from BASIC to Python3 by Bernard Cooke (bernardcooke53)
55
Tested with Python 3.8.10, formatted with Black and type checked with mypy.
66
"""
7+
78
import random
89
from typing import Iterable
910

20_Buzzword/python/buzzword.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Python port by Jeff Jetton, 2019
1818
"""
1919

20-
2120
import random
2221

2322

27_Civil_War/python/Civilwar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Original game design: Cram, Goodie, Hibbard Lexington H.S.
33
Modifications: G. Paul, R. Hess (Ties), 1973
44
"""
5+
56
import enum
67
import math
78
import random

28_Combat/python/combat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def attack_first() -> None:
6666
print(f"YOU LOST {str(num_units)} MEN FROM YOUR ARMY.")
6767
usr_army = usr_army - num_units
6868
elif num_units < (2 * usr_army / 3):
69-
print(f"YOU LOST {int(num_units / 3)} MEN, BUT I LOST {int(2 * cpu_army / 3)}")
69+
print(
70+
f"YOU LOST {int(num_units / 3)} MEN, BUT I LOST {int(2 * cpu_army / 3)}"
71+
)
7072
usr_army = int(usr_army - (num_units / 3))
7173
cpu_army = 0
7274
else:

30_Cube/python/cube.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def play_game() -> None:
3131
for _ in range(5):
3232
while True:
3333
mine = mine_position()
34-
if (
35-
mine not in mines
36-
and mine != (1, 1, 1)
37-
and mine != (3, 3, 3)
38-
):
34+
if mine not in mines and mine != (1, 1, 1) and mine != (3, 3, 3):
3935
break
4036
mines.append(mine)
4137
wager = -1

0 commit comments

Comments
 (0)