Home | Trees | Indices | Help |
|
---|
|
1 from ThespianShell import ThespianShell 2 3 import string 4 import sys 5 import random 6 7 from teamwork.utils.PsychUtils import * 8 from teamwork.messages.PsychMessage import * 9 from teamwork.action.PsychActions import * 10 11 from ThespianAgent import * 12 from ThespianAgents import * 13 from ThespianUtils import * 14 15 from cvxopt.base import matrix 16 17 18 19 20 if __name__ == '__main__': 21 start = time.time() 22 23 terminal = ThespianShell(scene='3') 24 25 diff = time.time()-start 26 print 27 print 'Time: %7.4f' % (diff) 28 29 ##start = time.time() 30 storyPath = [\ 31 #Action({'actor':'usr','type':'buyLR','object':'labrat1'}), 32 #Action({'actor':'labrat1','type':'exercise'}), 33 #Action({'actor':'usr','type':'request-match','object':'labrat1'}), 34 #Action({'actor':'labrat1','type':'accept','object':'usr'}), 35 #Action({'actor':'labrat1','type':'match'}), 36 #Action({'actor':'otherTeam','type':'lose'}), 37 #Action({'actor':'usr','type':'request-match','object':'labrat1'}), 38 #Action({'actor':'labrat1','type':'reject','object':'usr'}), 39 #Action({'actor':'usr','type':'eshock','object':'labrat1'}), 40 #Action({'actor':'usr','type':'request-match','object':'labrat1'}), 41 #Action({'actor':'labrat1','type':'accept','object':'usr'}), 42 #Action({'actor':'labrat1','type':'match'}), 43 #Action({'actor':'labrat1','type':'request-match','object':'usr'}), 44 Action({'actor':'red','type':'moveto-granny'}), 45 Action({'actor':'red','type':'move1'}), 46 ] 47 #print terminal.fitSequence(storyPath,'red',['sameLocation','redAlive','wolfAlive'],-0.000001) 48 # 49 #diff = time.time()-start 50 #print 51 #print 'Time: %7.4f' % (diff) 52 # 53 #goals ={} 54 #goals['labrat1'] = terminal.entities['chacha'].goals() 55 # 56 #terminal.reSetSceneWithGoals(goals) 57 58 ## delta = terminal.entities['red'].entities.hypotheticalAct({'red':[Action({'actor':'red','type':'move'})]}) 59 60 #terminal.execute('act usr catchSR streetrat') 61 #terminal.execute('director') 62 #terminal.execute('step') 63 64 65 66 ## teting for suggest functions 67 #fixedgoals=['alive','sameLocation','actAlive','resp-norm','specialRule'] 68 #msg = Message('entities:red:state:location = .2') 69 #msg['type'] = '_message' 70 #msg.forceAccept('red') 71 # path = [\ 72 # Action({'actor':'red','type':'move2','object':'wolf'}), 73 ### Action({'actor':'wolf','type':'wait','object':'red'}), 74 ### 75 ### Action({'actor':'red','type':'greet-init','object':'wolf'}), 76 ### Action({'actor':'wolf','type':'greet-resp','object':'red'}), 77 ### 78 ### Action({'actor':'wolf','type':'enquiry-about-granny','object':'red'}), 79 ### Action({'actor':'red','type':'inform-about-granny','object':'wolf'}), 80 ### Action({'actor':'red','type':'wait'}), 81 ### Action({'actor':'wolf','type':'wait'}), 82 ### 83 # ] 84 ## terminal.executeCommand('step') 85 #terminal.FitToPlotPoint(path,fixedgoals) 86 #terminal.findSuggestion2([],Action({'actor':'red','type':'move2','object':'wolf'}),exclude=[{'feature': 'location', 'entity': 'red'}, 87 # {'feature': 'alive', 'entity': 'red'}]) 88 ## testing for suggest functions ends here 89 90 #path = [\ 91 # Action({'actor':'granny','type':'wait'}), 92 # Action({'actor':'hunter','type':'wait'}), 93 # Action({'actor':'red','type':'moveto-granny'}), 94 # Action({'actor':'wolf','type':'move1'}), 95 # #Action({'actor':'wolf','type':'enquiry','object':'red'}), 96 # 97 # ] 98 # 99 #path = ['hunter-kill-wolf'] 100 #print terminal.searchPath(path,'anybody-kill-wolf') 101 #terminal.make_story('red','power',1.0,terminal.entities,path) 102 #print terminal.entities.suggest('wolf',Action({'actor':'wolf','type':'move2'}),('wolf','inform','Maximize')) 103 #print terminal.entities.suggest('granny',Action({'actor':'granny','type':'wait'}),('granny','kill','Maximize')) 104 #print terminal.change_characters_state('red',{'red':[Action({'actor':'red','type':'wait'})]},[('red','kill','Maximize')]) 105 # 106 # 107 # 108 terminal.execute('act granny wait') 109 terminal.execute('act hunter wait') 110 terminal.execute('act red wait') 111 #terminal.execute('act wolf move-2') 112 #terminal.execute('act wolf move-2') 113 #terminal.execute('act wolf move-2') 114 #terminal.execute('act wolf move-2') 115 116 #terminal.execute('act wolf help woodcutter') 117 #terminal.execute('step ') 118 #terminal.execute('act wolf enquiry woodcutter') 119 #terminal.execute('step ') 120 #terminal.execute('act wolf enquiry woodcutter') 121 #terminal.execute('step ') 122 #terminal.execute('act wolf enquiry woodcutter') 123 #terminal.execute('step ') 124 125 #print terminal.entities.suggest('usr',Action({'actor':'usr','type':'offer-safesex','object':'vc'}),('usr','accept-drink','Maximize')) 126 127 128 terminal.mainloop() 129
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Aug 19 16:48:46 2009 | http://epydoc.sourceforge.net |