From 890fd029b3ee1dee4a0c1c2430b061cd66b8b8e8 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Sun, 18 Feb 2024 14:19:02 +0200 Subject: Refactor & comment bots. --- src/miinaharava/bots/bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/miinaharava/bots/bot.py') diff --git a/src/miinaharava/bots/bot.py b/src/miinaharava/bots/bot.py index cfeedce..b00f9a6 100644 --- a/src/miinaharava/bots/bot.py +++ b/src/miinaharava/bots/bot.py @@ -91,8 +91,12 @@ class Bot(): count+=1 return count + def are_neighbours(self, tile1, tile2): + """ Kertoo ovatko laatat naapureita keskenään """ + return abs(tile1[0]-tile2[0])==1 or abs(tile1[1]-tile2[1])==1 + def known_tile(self, tile): - """ Kortoo onko laatta merkitty tai avattu. """ + """ Kertoo onko laatta merkitty tai avattu. """ return self.matrix[tile[0]][tile[1]] < Tile.UNOPENED def number_tile(self, tile): -- cgit v1.2.3