mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-28 21:54:17 -08:00
Python: Add type annotations to all 'print' functions (#662)
* Add test to superstartrek and fixes several issues in superstartrek - I probably introduced them 🙈
* Mastermind type annotations
This commit is contained in:
@@ -211,7 +211,7 @@ def jump_stats(previous_jumps, chute_altitude):
|
||||
return n_previous_jumps, n_better
|
||||
|
||||
|
||||
def print_splat(time_on_impact):
|
||||
def print_splat(time_on_impact) -> None:
|
||||
"""Parachute opened too late!"""
|
||||
print(f"{time_on_impact:.2f}\t\tSPLAT")
|
||||
print(
|
||||
@@ -232,7 +232,7 @@ def print_splat(time_on_impact):
|
||||
)
|
||||
|
||||
|
||||
def print_results(n_previous_jumps, n_better):
|
||||
def print_results(n_previous_jumps, n_better) -> None:
|
||||
"""Compare current jump to previous successful jumps."""
|
||||
k = n_previous_jumps
|
||||
k1 = n_better
|
||||
@@ -277,13 +277,13 @@ def print_results(n_previous_jumps, n_better):
|
||||
)
|
||||
|
||||
|
||||
def print_centered(msg):
|
||||
def print_centered(msg: str) -> None:
|
||||
"""Print centered text."""
|
||||
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def print_header():
|
||||
def print_header() -> None:
|
||||
print_centered("SPLAT")
|
||||
print_centered("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
|
||||
print(
|
||||
|
||||
Reference in New Issue
Block a user