X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fsrc%2Fgame.py;h=15c53b1315086129fcc8dd21497b1ad7b3393bd9;hp=73adfe75cb078c1c87bc08b231ce2b2cacc2db6f;hb=538a32cb30f21a1a48653d7b639ab0c82db44d83;hpb=318bb473add1bf88ccc1c7edacb0feba0249e401 diff --git a/qchess/src/game.py b/qchess/src/game.py index 73adfe7..15c53b1 100644 --- a/qchess/src/game.py +++ b/qchess/src/game.py @@ -15,11 +15,10 @@ class GameThread(StoppableThread): self.cond = threading.Condition() # conditional for some reason, I forgot self.final_result = "" self.server = server + self.retry_illegal = False - - - + # Run the game (run in new thread with start(), run in current thread with run()) def run(self): @@ -146,14 +145,17 @@ class GameThread(StoppableThread): break except Exception,e: #if False: - result = e.message - sys.stderr.write("qchess.py exception: "+result + "\n") - - self.stop() + - with self.lock: - self.final_result = self.state["turn"].colour + " " + e.message - break + result = e.message + if self.retry_illegal: + self.state["turn"].update(result); + else: + sys.stderr.write("qchess.py exception: "+result + "\n") + self.stop() + with self.lock: + self.final_result = self.state["turn"].colour + " " + e.message + break