Skip to content

Commit 556ea51

Browse files
committed
game over should type any key
1 parent e5ad3a0 commit 556ea51

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@
5454

5555
## 运行
5656
下载zip包,执行双击 typewords.exe
57+
58+
运行后,可点击左上角图标,在下拉菜单中选“属性”,设置字体Font,方便孩子看得更清楚。

typewords.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TypeWords:
99
sheetnames={}
1010

1111
def __init__(self):
12-
self.count = 0
12+
self.points = 0
1313
self.dicts={}
1414
# get words
1515
self.words = excel.ReadExcel('words.xlsx')
@@ -39,7 +39,7 @@ def choose_types(self):
3939
self.dicts = self.words.read_data(self.params["type"])
4040

4141
def help_print(self):
42-
print("打字练习,小学英语单词版. 输入[\exit]结束练习. ")
42+
print("打字练习,小学英语单词版. 输入[\exit]结束练习. 负分将结束. ")
4343
print("Author: Andy zhou<ablozhou@gmail.com> 2021")
4444
print("命令列表:")
4545
print("-"*10)
@@ -73,13 +73,14 @@ def practise(self):
7373
continue
7474

7575
if ans == word:
76-
self.count += leng
77-
print("---%d---\n%s\n" % (self.count, self.dicts[ans]))
76+
self.points += leng
77+
print("---%d---\n%s\n" % (self.points, self.dicts[ans]))
7878
else:
79-
self.count -= leng
80-
print("Try again... %d\n" % self.count)
81-
if self.count < 0:
82-
print("Your have not enough points, game over!!!")
79+
self.points -= leng
80+
print("Try again... %d\n" % self.points)
81+
if self.points <= 0:
82+
print("GAME OVER!!! Your have not enough points!")
83+
input("Type any key to exit...")
8384
break
8485

8586

0 commit comments

Comments
 (0)