git.ucc.asn.au
/
progcomp10.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implemented UUID passing in externAgent and C. Enabled externAgents to print debug...
[progcomp10.git]
/
src
/
link
/
externAgent.py
diff --git
a/src/link/externAgent.py
b/src/link/externAgent.py
index
d3e3af1
..
0680f33
100644
(file)
--- a/
src/link/externAgent.py
+++ b/
src/link/externAgent.py
@@
-16,11
+16,13
@@
class externAgent (BaseAgent):
BaseAgent.__init__(self)
try:
self.process = subprocess.Popen(externName, stdin=subprocess.PIPE,
BaseAgent.__init__(self)
try:
self.process = subprocess.Popen(externName, stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
universal_newlines=True)
except Exception, e:
print ("Error spawning \"%s\": " % externName), e
universal_newlines=True)
except Exception, e:
print ("Error spawning \"%s\": " % externName), e
-
+
+ self.process.stdin.write ( ' '.join( ["HI", repr(self.GetID()), "\r\n"] ) )
+
def stringToItem( self, str ):
if str == "Rock":
return Rock
def stringToItem( self, str ):
if str == "Rock":
return Rock
@@
-73,7
+75,7
@@
class externAgent (BaseAgent):
return attack, bluff
except:
#agent is insane
return attack, bluff
except:
#agent is insane
- print "Agent is insane:", self
+ print "Agent is insane:", self
, self.GetID()
pass
def Defend (self, foe, bluff ):
pass
def Defend (self, foe, bluff ):
@@
-85,7
+87,7
@@
class externAgent (BaseAgent):
return defence
except:
#agent is insane
return defence
except:
#agent is insane
- print "Agent is insane:", self
+ print "Agent is insane:", self
, self.GetID()
pass
def Results (self, foe, isInstigatedByYou, winner, attItem, defItem, bluffItem, pointDelta):
pass
def Results (self, foe, isInstigatedByYou, winner, attItem, defItem, bluffItem, pointDelta):
UCC
git Repository :: git.ucc.asn.au