mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-21 23:00:43 -08:00
BUG: Hangman (Python) had a List-vs-Str comparison
MAINT: Add type annotations to find such issues
This commit is contained in:
@@ -20,7 +20,7 @@ def print_with_tab(space_count: int, msg: str) -> None:
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def play_scenario():
|
||||
def play_scenario() -> bool:
|
||||
acid_amount = random.randint(1, 50)
|
||||
|
||||
water_amount = 7 * acid_amount / 3
|
||||
@@ -43,27 +43,23 @@ def play_scenario():
|
||||
return True
|
||||
|
||||
|
||||
def show_failure():
|
||||
def show_failure() -> None:
|
||||
print(" SIZZLE! YOU HAVE JUST BEEN DESALINATED INTO A BLOB")
|
||||
print(" OF QUIVERING PROTOPLASM!")
|
||||
|
||||
|
||||
def show_success():
|
||||
print(" GOOD JOB! YOU MAY BREATHE NOW, BUT DON'T INHALE THE FUMES!")
|
||||
print()
|
||||
def show_success() -> None:
|
||||
print(" GOOD JOB! YOU MAY BREATHE NOW, BUT DON'T INHALE THE FUMES!\n")
|
||||
|
||||
|
||||
def show_ending():
|
||||
def show_ending() -> None:
|
||||
print(f" YOUR {MAX_LIVES} LIVES ARE USED, BUT YOU WILL BE LONG REMEMBERED FOR")
|
||||
print(" YOUR CONTRIBUTIONS TO THE FIELD OF COMIC BOOK CHEMISTRY.")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print_with_tab(33, "CHEMIST")
|
||||
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n")
|
||||
|
||||
print("THE FICTITIOUS CHEMICAL KRYPTOCYANIC ACID CAN ONLY BE")
|
||||
print("DILUTED BY THE RATIO OF 7 PARTS WATER TO 3 PARTS ACID.")
|
||||
|
||||
Reference in New Issue
Block a user