bug fix: consider STEPPED_MINE as a flagged mine

This commit is contained in:
JerryXiao 2019-01-15 11:54:47 +08:00
parent 2798a3dc22
commit ce49cf9528
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA
3 changed files with 5 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
tgmsbot.db

View file

@ -96,7 +96,7 @@ class Board():
for x in np.nditer(self.map): for x in np.nditer(self.map):
if x <= 8: if x <= 8:
unopened += 1 unopened += 1
elif x == 19: elif x in (19, DEAD):
mines_opened += 1 mines_opened += 1
if mines_opened == self.mines: if mines_opened == self.mines:
return True return True
@ -110,6 +110,7 @@ class Board():
if not automatic and self.map[row][col] == 9: if not automatic and self.map[row][col] == 9:
self.map[row][col] = DEAD self.map[row][col] = DEAD
self.state = 3 self.state = 3
return
elif self.map[row][col] == 0: elif self.map[row][col] == 0:
self.map[row][col] += 10 # open this block self.map[row][col] += 10 # open this block
# open other blocks # open other blocks
@ -122,7 +123,7 @@ class Board():
neighbour_mine_opened = 0 neighbour_mine_opened = 0
neighbour_unopened = 0 neighbour_unopened = 0
for neighbour in self.__iter_neighbour(row, col, return_rc=False): for neighbour in self.__iter_neighbour(row, col, return_rc=False):
if neighbour == 19: if neighbour in (19, DEAD):
neighbour_mine_opened += 1 neighbour_mine_opened += 1
if neighbour <= 9: if neighbour <= 9:
neighbour_unopened += 1 neighbour_unopened += 1

View file

@ -40,7 +40,7 @@ WIN_TEXT_TEMPLATE = "哇所有奇怪的地方都被你打开啦…好羞羞\n" \
STEP_TEXT_TEMPLATE = "{last_player} 踩到了地雷!\n" \ STEP_TEXT_TEMPLATE = "{last_player} 踩到了地雷!\n" \
"时间{time}秒,超时{timeouts}\n\n" \ "时间{time}秒,超时{timeouts}\n\n" \
"{last_player} {reward}\n\n" \ "{last_player} {reward}\n\n" \
"生命值:({remain}/{ttl})" "雷区生命值:({remain}/{ttl})"
LOSE_TEXT_TEMPLATE = "一道火光之后,你就在天上飞了呢…好奇怪喵\n" \ LOSE_TEXT_TEMPLATE = "一道火光之后,你就在天上飞了呢…好奇怪喵\n" \
"地图Op {s_op} / Is {s_is} / 3bv {s_3bv}\n操作总数 {ops_count}\n" \ "地图Op {s_op} / Is {s_is} / 3bv {s_3bv}\n操作总数 {ops_count}\n" \
"统计:\n{ops_list}\n{last_player} 是我们中出的叛徒!\n\n" \ "统计:\n{ops_list}\n{last_player} 是我们中出的叛徒!\n\n" \