Interactions 0 ▲ ronjeffries.com 1 hour ago · Tech · hide · 0 comments Hello, loves! Let’s figure out the new interaction feature, test, and do it. Success but with a reset and a general feeling of clumsiness. I think that the behavior we want is: When moving into a new cell, run the interactions and move if they all return true. (This is the current behavior.) If for any reason the move to a new cell is not allowed, remain where you are, run the interactions (again) there, ignoring the boolean results. How do things work now? Thanks for asking, I was kind of wondering myself. class Dungeon: def move_player(self, direction): new_cell = self.player_cell.attempt_move(direction) if new_cell != self.player_cell: self.place_player_at(new_cell) def place_player_at(self, cell): interactor = Interactor(self, cell) if all(interactor.execute(item) for item in list(self.contents_at(cell))): self.player_cell = cell Looks like we should inspect the Interactor: class Interactor: def __init__(self, dungeon, cell): self.dungeon = dungeon self.cell = cell def… No comments yet. Log in to reply on the Fediverse. Comments will appear here.