We couldn’t get in the straightforward way. Is there a more sneaky way to do this? Tiny steps, many commits, very tedious. One semi-interesting refactoring. We’re trying to get the room out of Cell. Replacing this: class DungeonLayout: def available_neighbors(self, cell): return [neighbor for neighbor in self.neighbors(cell) if neighbor.is_available] … with this, which is supposed to be equivalent: class DungeonLayout: def available_neighbors(self, cell): return [neighbor for neighbor in self.neighbors(cell) if self.is_available(neighbor)] … breaks tests. The reason seems to be that there’s code like this going on: class RoomMaker: def _build_cave(self, number_of_cells, origin): new_cell: Cell = origin for _ in range(number_of_cells): self.take(new_cell) self.growth_candidates.append(new_cell) new_cell = self.find_adjacent_cell(new_cell) if new_cell is None: return def take(self, new_cell: Cell): self.cells.append(new_cell) new_cell.room = self def find_adjacent_cell(self, previous):…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.