コード例 #1
0
class Character:
    def __init__(self, name, avatar, sprite, scriptfile):
        self.name = name
        self.coordinates = (0,0)
        self.avatar = avatar
        self.sprite = sprite
        self.eliza = Eliza()
        #self.outputbox = OutputBox()
        #self.inputbox = InputBox()
        self.leadinfulfilled = False
        with open(scriptfile) as character_script:
            content = character_script.read()
            self.eliza.combined_script += content
    
    def load(self):
        self.eliza.load()

    def initiateDialogue(self, gameState):
        # Put main function of textbox here
        pass
コード例 #2
0
#!/usr/bin/env python3
from eliza import Eliza

eliza = Eliza()
eliza.load('doctor-fr.txt')

print(eliza.initial())
while True:
    said = input('> ')
    response = eliza.respond(said)
    if response is None:
        break
    print(response)
print(eliza.final())