mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-26 12:51:29 -08:00
Python: Add type annotations
This commit is contained in:
committed by
Alexander Wunschik
parent
b95a514e84
commit
83b3dc402c
@@ -49,7 +49,7 @@ def print_legs(n_legs):
|
||||
print()
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
print_n_whitespaces(34)
|
||||
print("BUG")
|
||||
print_n_whitespaces(15)
|
||||
@@ -59,8 +59,8 @@ def main():
|
||||
print("THE GAME BUG")
|
||||
print("I HOPE YOU ENJOY THIS GAME.")
|
||||
print()
|
||||
Z = input("DO YOU WANT INSTRUCTIONS? ")
|
||||
if Z != "NO":
|
||||
want_instructions = input("DO YOU WANT INSTRUCTIONS? ")
|
||||
if want_instructions != "NO":
|
||||
print("THE OBJECT OF BUG IS TO FINISH YOUR BUG BEFORE I FINISH")
|
||||
print("MINE. EACH NUMBER STANDS FOR A PART OF THE BUG BODY.")
|
||||
print("I WILL ROLL THE DIE FOR YOU, TELL YOU WHAT I ROLLED FOR YOU")
|
||||
@@ -269,8 +269,8 @@ def main():
|
||||
Y = Y + 2
|
||||
if C == 1:
|
||||
continue
|
||||
Z = input("DO YOU WANT THE PICTURES? ")
|
||||
if Z != "NO":
|
||||
want_pictures = input("DO YOU WANT THE PICTURES? ")
|
||||
if want_pictures != "NO":
|
||||
print("*****YOUR BUG*****")
|
||||
print_n_newlines(2)
|
||||
if A != 0:
|
||||
|
||||
@@ -9,11 +9,12 @@ Ported by Peter Sharp
|
||||
|
||||
from collections import namedtuple
|
||||
from random import randint
|
||||
from typing import Any, Dict
|
||||
|
||||
PAGE_WIDTH = 64
|
||||
|
||||
|
||||
def main(states, data):
|
||||
def main(states, data) -> None:
|
||||
"""
|
||||
Starts the game loop using given states and data
|
||||
|
||||
@@ -327,7 +328,7 @@ if __name__ == "__main__":
|
||||
)
|
||||
|
||||
# all the data used by the game
|
||||
data = {
|
||||
data: Dict[str, Any] = {
|
||||
"state": "start",
|
||||
"partNo": None,
|
||||
"players": {"YOU": [0] * len(part_types), "I": [0] * len(part_types)},
|
||||
|
||||
Reference in New Issue
Block a user