summaryrefslogtreecommitdiff
path: root/bots
diff options
context:
space:
mode:
Diffstat (limited to 'bots')
-rw-r--r--bots/bot.py18
-rw-r--r--bots/dssp.py10
-rw-r--r--bots/simple.py6
3 files changed, 17 insertions, 17 deletions
diff --git a/bots/bot.py b/bots/bot.py
index f32b466..cc09936 100644
--- a/bots/bot.py
+++ b/bots/bot.py
@@ -7,7 +7,7 @@ class Bot():
def __init__(self, **opts):
self.uncertain = opts['uncertain'] if 'uncertain' in opts else False
self.safe_tiles = set()
- self.bomb_tiles = set()
+ self.mine_tiles = set()
self.matrix = []
self.w = 0
self.h = 0
@@ -25,14 +25,14 @@ class Bot():
if self.safe_tiles:
x, y = self.safe_tiles.pop()
return Action.SAFE, x, y
- if self.bomb_tiles:
- x, y = self.bomb_tiles.pop()
- return Action.BOMB, x, y
+ if self.mine_tiles:
+ x, y = self.mine_tiles.pop()
+ return Action.MINE, x, y
return Action.NOOP, 0, 0
def saved_hints(self):
""" onko muuveja varastossa """
- return self.safe_tiles or self.bomb_tiles
+ return self.safe_tiles or self.mine_tiles
def hint(self, matrix, cursor_x, cursor_y):
""" antaa vinkin. tässä tapauksessa ei mitään """
@@ -73,14 +73,14 @@ class Bot():
def remove_number_tiles(self, tiles):
""" poistaa vapaat ja vapaaksi merkityt alueet ja numerolaatat """
for tile in list(tiles):
- if self.matrix[tile[0]][tile[1]] < Tile.FLAG_BOMB:
+ if self.matrix[tile[0]][tile[1]] < Tile.FLAG_MINE:
tiles.remove(tile)
- def remove_bomb_tiles(self, tiles):
+ def remove_mine_tiles(self, tiles):
""" poistaa pommit ja pommiksi merkityt """
count=0
for tile in list(tiles):
- if self.matrix[tile[0]][tile[1]] in (Tile.BOMB, Tile.FLAG_BOMB):
+ if self.matrix[tile[0]][tile[1]] in (Tile.MINE, Tile.FLAG_MINE):
tiles.remove(tile)
count+=1
return count
@@ -91,7 +91,7 @@ class Bot():
def number_tile(self, tile):
""" tutkii onko numerolaatta """
- return 0 < self.matrix[tile[0]][tile[1]] < Tile.BOMB
+ return 0 < self.matrix[tile[0]][tile[1]] < Tile.MINE
def count_unknowns(self, tiles):
""" laskee tunnistamattomat laatat """
diff --git a/bots/dssp.py b/bots/dssp.py
index 78dec8e..1e559a2 100644
--- a/bots/dssp.py
+++ b/bots/dssp.py
@@ -25,8 +25,8 @@ class DSSPBot(SimpleBot):
n2 = self.get_neighbours(tile2)
self.remove_number_tiles(n1)
self.remove_number_tiles(n2)
- c1 -= self.remove_bomb_tiles(n1)
- c2 -= self.remove_bomb_tiles(n2)
+ c1 -= self.remove_mine_tiles(n1)
+ c2 -= self.remove_mine_tiles(n2)
# otetaan vain alue1:n laatat pois vähennetään se pommeista
# näin tiedetään montako pommia on jäätävä yhteiselle alueelle
@@ -48,8 +48,8 @@ class DSSPBot(SimpleBot):
for safe in n2:
self.safe_tiles.add(safe)
if cc == len(nc) and c2 == len(n2):
- for bomb in n2:
- self.bomb_tiles.add(bomb)
+ for mine in n2:
+ self.mine_tiles.add(mine)
return self.saved_hints()
@@ -58,7 +58,7 @@ class DSSPBot(SimpleBot):
tiles = self.get_border_tiles()
for tile in tiles:
n = self.get_neighbours(tile)
- c = self.get_value(tile) - self.remove_bomb_tiles(n)
+ c = self.get_value(tile) - self.remove_mine_tiles(n)
self.remove_number_tiles(n)
for ntile in n:
heatmap[ntile] += c/len(n)
diff --git a/bots/simple.py b/bots/simple.py
index cb3d25c..54e2d05 100644
--- a/bots/simple.py
+++ b/bots/simple.py
@@ -12,13 +12,13 @@ class SimpleBot(Bot):
c = self.get_value(tile)
n = self.get_neighbours(tile)
self.remove_number_tiles(n)
- c -= self.remove_bomb_tiles(n)
+ c -= self.remove_mine_tiles(n)
if c == 0:
for safe in n:
self.safe_tiles.add(safe)
if c == len(n):
- for bomb in n:
- self.bomb_tiles.add(bomb)
+ for mine in n:
+ self.mine_tiles.add(mine)
return self.saved_hints()
def lucky_guess(self):