116 days ago · Tech · hide · Fediverse post

Hello, loves! I’d like to make the KeyPress code simpler. Here’s something that works. Do we like it? Yes, but we don’t love it. Tout le monde déteste l’IA. Here’s the KeyPress code for D: class KeyPress: elif symbol == arcade.key.D: more = self.stepper.step() maker = DungeonViewMaker(self.dungeon) maker.update(self.view) if not more: self.dungeon.run() Here’s what I want: Wishful Thinking: elif symbol == arcade.key.D: more = self.stepper.step(self.view) if not more: self.dungeon.run() Here’s how I changed the stepper: class BuildStepper: def __init__(self, table, layout, dungeon ): self.table = table self.index = 0 self.layout = layout self.dungeon = dungeon def step(self, view=None): if self._more_to_do(): self._do_one_step(view) return self._more_to_do() def _more_to_do(self): return self.index < len(self.table) def _do_one_step(self, view): self.table[self.index](self.dungeon, self.layout) if view: maker = DungeonViewMaker(self.dungeon) maker.update(view) self.index += 1 The game…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town