mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-26 04:41:52 -08:00
Python: Add type annotations
This commit is contained in:
committed by
Alexander Wunschik
parent
b95a514e84
commit
83b3dc402c
@@ -14,7 +14,13 @@
|
||||
|
||||
import random
|
||||
from math import sqrt
|
||||
from typing import Any, List
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
# Global variables
|
||||
restart = False
|
||||
s = 0
|
||||
e = 0
|
||||
d: List[int] = []
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Utility functions
|
||||
@@ -923,10 +929,10 @@ def end_game(won=False, quit=True, enterprise_killed=False):
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
global restart
|
||||
|
||||
f = {
|
||||
f: Dict[str, Callable[[], None]] = {
|
||||
"NAV": navigation,
|
||||
"SRS": short_range_scan,
|
||||
"LRS": long_range_scan,
|
||||
|
||||
@@ -139,7 +139,7 @@ def print_instructions():
|
||||
print(" GALACTIC REGIONS REFERRED TO IN THE GAME.")
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
print_header()
|
||||
if not get_yes_no("DO YOU NEED INSTRUCTIONS (Y/N)? "):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user