Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Human = Robot = Interlocutor solution in Creative category for Dialogues by veky
class Interlocutor(str):
def send(who, message): who.active_chat.transcript.append((who, message))
Human = Robot = Interlocutor
onezero = lambda char: format(char.casefold() not in 'aeiou', 'b')
class Chat:
def __init__(chat): chat.transcript = []
def connect(chat, who): who.active_chat = chat
connect_human = connect_robot = connect
def show_human_dialogue(chat): return '\n'.join(chat.show_dialogue())
def show_robot_dialogue(chat): return '\n'.join(chat.show_dialogue(onezero))
def show_dialogue(chat, translation=lambda char: char):
for who, line in chat.transcript:
yield f"{who} said: " + ''.join(map(translation, line))
June 27, 2018
Comments: