示例#1
0
文件: run.py 项目: dramatis/dramatis
#!/usr/bin/env python

import inspect
import sys
import os.path

sys.path[0:0] = [ os.path.join( os.path.dirname( inspect.getabsfile( inspect.currentframe() ) ), '..', '..', '..', 'lib' ) ]
sys.path[0:0] = [ os.path.join( os.path.dirname( inspect.getabsfile( inspect.currentframe() ) ), '..' ) ]

from kid import Kid

tom = Kid( "Tom" )
becky = Kid( "Becky", tom )
dick = Kid( "Dick", becky )
jane = Kid( "Jane", dick )
harry = Kid( "Harry", jane )
sally = Kid( "Sally", harry )

phrases = [ "his mom locked her keys in the car, " + \
            "so he should get a ride home with Hector",
            "Mac King is a comedy magic genius" ]

for phrase in phrases:
    print "Teacher:", phrase
    sally.whisper( phrase )

for phrase in phrases:
    print "Teacher heard:", tom.ask()
示例#2
0
文件: run.py 项目: halorgium/dramatis
#!/usr/bin/env python

import inspect
import sys
import os.path

sys.path[0:0] = [os.path.join(os.path.dirname(inspect.getabsfile(inspect.currentframe())), "..", "..", "..", "lib")]
sys.path[0:0] = [os.path.join(os.path.dirname(inspect.getabsfile(inspect.currentframe())), "..")]

from kid import Kid

tom = Kid("Tom")
becky = Kid("Becky", tom)
dick = Kid("Dick", becky)
jane = Kid("Jane", dick)
harry = Kid("Harry", jane)
sally = Kid("Sally", harry)

phrase = "his mom locked her keys in the car, " + "so he should get a ride home with Hector"

print "Teacher:", phrase
sally.whisper(phrase)
heard = sally.ask()
print "Teacher heard:", heard