mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 04:15:45 -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:
@@ -8,7 +8,7 @@ class Disk:
|
||||
def size(self):
|
||||
return self.__size
|
||||
|
||||
def print(self):
|
||||
def print(self) -> None:
|
||||
print("[ %s ]" % self.size())
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class Tower:
|
||||
raise Exception("empty pop")
|
||||
return self.__disks.pop()
|
||||
|
||||
def print(self):
|
||||
def print(self) -> None:
|
||||
r = "Needle: [%s]" % (", ".join([str(x.size()) for x in self.__disks]))
|
||||
print(r)
|
||||
|
||||
@@ -63,7 +63,7 @@ class Game:
|
||||
def winner(self):
|
||||
return self.__towers[0].empty() and self.__towers[1].empty()
|
||||
|
||||
def print(self):
|
||||
def print(self) -> None:
|
||||
for t in self.__towers:
|
||||
t.print()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user