def test_not_mines_even_with_headstone(): display = [ "-----", "|...-", "|.|.|", "|^..|", "|.[<|", "---.-", ] assert not looks_like_mines(display)
def _dispatch_branch_change_event(self): level = [line.translate(ibm) for line in self.term.display] if 6 <= self.dlvl <= 10 and dungeon.looks_like_sokoban(level): # If the player arrived at a level that looks like sokoban, she's # definitely in sokoban. event.dispatch("branch-change", "sokoban") elif self.last_move == "down" and 3 <= self.dlvl <= 6 and \ dungeon.looks_like_mines(level): # The only entrace to the mines is between levels 3 and 5 and # the player has to have been traveling down to get there. Also # count it if the dlvl didn't change, because it *might* take # a couple turns to identify the mines. Sokoban, by it's nature # however is instantly identifiable. event.dispatch("branch-change", "mines")
def _branch_change_event(self, data): level = [line.translate(ibm) for line in self.term.display] if 6 <= self.dlvl <= 10 and dungeon.looks_like_sokoban(level): # If the player arrived at a level that looks like sokoban, she's # definitely in sokoban. self.events.dispatch("branch-changed", "sokoban") elif self.last_move == "down" and 3 <= self.dlvl <= 6 and \ dungeon.looks_like_mines(level): # The only entrace to the mines is between levels 3 and 5 and # the player has to have been traveling down to get there. Also # count it if the dlvl didn't change, because it *might* take # a couple turns to identify the mines. Sokoban, by it's nature # however is instantly identifiable. self.events.dispatch("branch-changed", "mines")
def test_not_mines_even_with_strip(): display = [ "-- ", " ---- ", ] assert not looks_like_mines(display)