Skip to content

Commit

Permalink
bugfix: ensure scores cannot be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
privong authored and George C. Privon committed Nov 21, 2018
1 parent f582a4f commit 50c82fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Fixed missing Abbey score type when Expansion 5 is used.
This requres running the following command in sqlite3: `update expansions set scoretypes="Abbey" where expansionID=5;`
* Include played Abbey tiles in the total number of tiles played.

* Ensure negative scores cannot be entered.

### 0.4.1 (18 November 2018)

Expand Down
8 changes: 6 additions & 2 deletions cgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,12 @@ def recordScore(self):
while not VALID:
points = input("Enter the total number of points: ")
try:
score['points'] = int(points)
VALID = True
pts = int(points)
if pts >= 0:
score['points'] = int(points)
VALID = True
else:
_sys.stderr.write("Score cannot be negative.\n")
except:
_sys.stderr.write("'" + points + "' is not a valid score.\n")
continue
Expand Down

0 comments on commit 50c82fb

Please sign in to comment.