mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-30 14:42:03 -08:00
Python: Add type annotations
This commit is contained in:
committed by
Alexander Wunschik
parent
b95a514e84
commit
83b3dc402c
@@ -82,12 +82,12 @@ def get_next_target(sea: SeaType) -> PointType:
|
||||
while True:
|
||||
try:
|
||||
guess = input("? ")
|
||||
point = guess.split(",")
|
||||
point_str_list = guess.split(",")
|
||||
|
||||
if len(point) != 2:
|
||||
if len(point_str_list) != 2:
|
||||
raise ValueError()
|
||||
|
||||
point = (int(point[0]), int(point[1]))
|
||||
point = (int(point_str_list[0]), int(point_str_list[1]))
|
||||
|
||||
if not is_within_sea(point, sea):
|
||||
raise ValueError()
|
||||
@@ -99,7 +99,7 @@ def get_next_target(sea: SeaType) -> PointType:
|
||||
)
|
||||
|
||||
|
||||
def setup_ships(sea: SeaType):
|
||||
def setup_ships(sea: SeaType) -> None:
|
||||
place_ship(sea, DESTROYER_LENGTH, 1)
|
||||
place_ship(sea, DESTROYER_LENGTH, 2)
|
||||
place_ship(sea, CRUISER_LENGTH, 3)
|
||||
|
||||
Reference in New Issue
Block a user