From ce49cf952852bcf15317337504e014df25da33b2 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 15 Jan 2019 11:54:47 +0800 Subject: [PATCH] bug fix: consider STEPPED_MINE as a flagged mine --- .gitignore | 1 + mscore.py | 5 +++-- tgmsbot.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c399ba --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tgmsbot.db diff --git a/mscore.py b/mscore.py index f1cc944..26752c9 100644 --- a/mscore.py +++ b/mscore.py @@ -96,7 +96,7 @@ class Board(): for x in np.nditer(self.map): if x <= 8: unopened += 1 - elif x == 19: + elif x in (19, DEAD): mines_opened += 1 if mines_opened == self.mines: return True @@ -110,6 +110,7 @@ class Board(): if not automatic and self.map[row][col] == 9: self.map[row][col] = DEAD self.state = 3 + return elif self.map[row][col] == 0: self.map[row][col] += 10 # open this block # open other blocks @@ -122,7 +123,7 @@ class Board(): neighbour_mine_opened = 0 neighbour_unopened = 0 for neighbour in self.__iter_neighbour(row, col, return_rc=False): - if neighbour == 19: + if neighbour in (19, DEAD): neighbour_mine_opened += 1 if neighbour <= 9: neighbour_unopened += 1 diff --git a/tgmsbot.py b/tgmsbot.py index 3cc5bd2..e30fee8 100644 --- a/tgmsbot.py +++ b/tgmsbot.py @@ -40,7 +40,7 @@ WIN_TEXT_TEMPLATE = "哇所有奇怪的地方都被你打开啦…好羞羞\n" \ STEP_TEXT_TEMPLATE = "{last_player} 踩到了地雷!\n" \ "时间{time}秒,超时{timeouts}次\n\n" \ "{last_player} {reward}\n\n" \ - "生命值:({remain}/{ttl})" + "雷区生命值:({remain}/{ttl})" LOSE_TEXT_TEMPLATE = "一道火光之后,你就在天上飞了呢…好奇怪喵\n" \ "地图:Op {s_op} / Is {s_is} / 3bv {s_3bv}\n操作总数 {ops_count}\n" \ "统计:\n{ops_list}\n{last_player} 是我们中出的叛徒!\n\n" \