From f8452c313ca78e5f04714331c4a222e8aed53805 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Sun, 18 Feb 2024 17:24:14 +0200 Subject: Bot doesn't need to know cursor coordinates. --- src/miinaharava/tui/tui.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/miinaharava/tui') diff --git a/src/miinaharava/tui/tui.py b/src/miinaharava/tui/tui.py index d7f7fb3..378b222 100644 --- a/src/miinaharava/tui/tui.py +++ b/src/miinaharava/tui/tui.py @@ -55,12 +55,12 @@ class Tui(): # automaattipeli avaa botin vinkit heti if self.autoplay: - action, x, y = self.bot.hint(matrix, x, y) + action, bx, by = self.bot.hint(matrix) if action != Action.NOOP: if self.delay: - self.draw.matrix(matrix, x, y) + self.draw.matrix(matrix, bx, by) time.sleep(self.delay/100) - return Action.OPEN if action==Action.SAFE else action, x, y + return Action.OPEN if action==Action.SAFE else action, bx, by # ilman näppiskäsittelijää voidaan lopettaa @@ -79,7 +79,10 @@ class Tui(): return (action, x, y) case Action.HINT: if self.bot is not None: - return self.bot.hint(matrix, x, y) + action, bx, by = self.bot.hint(matrix) + if action != Action.NOOP: + return (action, bx, by) + return (Action.NOOP, x, y) def game_over(self, matrix, x, y): """ tehtävät kun kuolee """ -- cgit v1.2.3