mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
add try/except to computer prompt, invalid input should not crash game
This commit is contained in:
@@ -902,7 +902,10 @@ class Game:
|
||||
if len(command) == 0:
|
||||
com = 6
|
||||
else:
|
||||
try:
|
||||
com = int(command)
|
||||
except ValueError:
|
||||
com = 6
|
||||
if com < 0:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user