-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminesweeper.py
More file actions
37 lines (30 loc) · 1 KB
/
minesweeper.py
File metadata and controls
37 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import core
import pages
def main() -> int:
while True:
try:
core.graphics.init()
retcode = gamemain()
break
except Exception:
core.logger.logError()
retcode = 1
finally:
core.graphics.end()
if retcode:
"""print("抱歉,该游戏出现错误,可输入“python3 {}”并按Enter键重新启动游戏。".format(
sys.argv[0]))"""
choice = (input(core.localize.tr("抱歉,该游戏出现错误。是否重新启动游戏?(y/n) "))
.lower())
if not (choice and choice[0] == 'y'):
break
print(core.localize.tr(
"如需启动游戏,可输入“python3 {}”并按Enter键。").format(sys.argv[0]))
return retcode
def gamemain() -> int:
gamewin = pages.mainpage.Minesweeper()
gamewin.doModel()
return 0
if __name__ == "__main__":
sys.exit(main())