This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this could be made to work with surprisingly little effort. | |
# no, i won't tell you how. please don't do it | |
class SnarlingBeastEvent(EncounterEvent): | |
language = 'english' | |
title = "a snarling beast" | |
text = "a snarling beast leaps out of the underbrush." | |
language = 'pig latin' | |
title = "anway arlingsnay eastbay" | |
text = "anway arlingsnay eastbay eapslay outway ofway ethay underbrushway." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_last(haystack, needle): | |
last_pos = -1 | |
while True: | |
next_pos = haystack.find(needle, last_pos + 1) | |
if next_pos < 0: | |
return last_pos | |
last_pos = next_pos |