summaryrefslogtreecommitdiff
path: root/bots
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-14 16:02:12 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-14 16:02:12 +0200
commit899d0997a6badae6535e9f69e0f6d70f3a272578 (patch)
tree05edf2028de4fa4294e5bcb8fd6c81bbdf849000 /bots
parent53eea87fe65c5c4f063664c424d4b49176a27984 (diff)
Adding the idiot bot for giving idiot hints.
Diffstat (limited to 'bots')
-rw-r--r--bots/bot.py14
-rw-r--r--bots/idiot.py17
2 files changed, 31 insertions, 0 deletions
diff --git a/bots/bot.py b/bots/bot.py
new file mode 100644
index 0000000..1b7fedd
--- /dev/null
+++ b/bots/bot.py
@@ -0,0 +1,14 @@
+""" bots/bot.py - bottien kantaisä """
+from tui.static import Action
+
+class Bot():
+ """ Bot - perusluokka perittäväksi """
+ # pylint: disable = too-few-public-methods
+ def __init__(self):
+ self.hints = 0
+
+ def hint(self, matrix, x, y):
+ """ antaa vinkin. tässä tapauksessa ei mitään """
+ # pylint: disable = unused-argument
+ self.hints += 1
+ return Action.NOOP, x, y
diff --git a/bots/idiot.py b/bots/idiot.py
new file mode 100644
index 0000000..4f1f9f4
--- /dev/null
+++ b/bots/idiot.py
@@ -0,0 +1,17 @@
+""" bots/idiot.py - se ensimmäinen botti joka tekee kaiken väärin """
+from bots.bot import Bot
+from tui.static import Action
+class IdiotBot(Bot):
+ """ IdiotBot - merkistsee kaikki turvallisiksi avata """
+ # pylint: disable = too-few-public-methods
+
+ def hint(self, matrix, x, y):
+ """ merkitsee jonkin ruudun """
+ super().hint(matrix, x, y)
+ # pylint: disable = consider-using-enumerate
+ for ty in range(len(matrix[0])):
+ for tx in range(len(matrix)):
+ if matrix[tx][ty]==10:
+ return(Action.SAFE, tx, ty)
+ return (Action.NOOP, x, y)
+ \ No newline at end of file