From 2382a4a451fb61177e8571b0726a6cb2e0febd0b Mon Sep 17 00:00:00 2001 From: 6328058bff7fbd7cde5c7d24 <6328058bff7fbd7cde5c7d24@devide> Date: Sun, 7 May 2023 07:08:12 +0000 Subject: [PATCH] Auto commit --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e29df16..1517b70 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ import random import time + def draw_dot(level): print(' ', end=' ') for i in range(level): @@ -128,6 +129,7 @@ while True: board = new_board(level) mines = lay_mines(level, level) draw_board(board,level) + start_time = time.time() while True: move = is_valid_move(input('请选择位置:'), level) if not move: continue @@ -136,4 +138,8 @@ while True: dig_mine(row, column, mines, level) if is_win(board, mines, level) or is_lose(board, mines, level): break draw_board(board,level) - if not play_again(): break \ No newline at end of file + end_time = time.time() + print(f"用时:{end_time-start_time:.2f}秒") + if not play_again(): + print("下次再见!") + break \ No newline at end of file -- GitLab