diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-18 17:24:14 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-18 17:24:14 +0200 |
commit | f8452c313ca78e5f04714331c4a222e8aed53805 (patch) | |
tree | 2bd492d332e5867b6875d560ce97072a27e3523f /src/miinaharava/tui | |
parent | 5e69623d022ecd747e20ca29e891d221c9ccbbab (diff) |
Bot doesn't need to know cursor coordinates.
Diffstat (limited to 'src/miinaharava/tui')
-rw-r--r-- | src/miinaharava/tui/tui.py | 11 |
1 files changed, 7 insertions, 4 deletions
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 """ |