X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fgame.py;h=efca0f8a6825fb6997f176c8f3fed9ce7735fc3d;hp=393672d469f2c7d839e4da7dbe3f903a5b1cca95;hb=707e794d26062516eb4188d1cd2902929613c46b;hpb=bfa63f1a2dc9c66399f8159857d4cc54f038eaa2;ds=inline diff --git a/qchess/game.py b/qchess/game.py index 393672d..efca0f8 100644 --- a/qchess/game.py +++ b/qchess/game.py @@ -22,8 +22,7 @@ class GameThread(StoppableThread): self.state["turn"] = p.base_player # "turn" contains the player who's turn it is else: self.state["turn"] = p - #try: - if True: + try: [x,y] = p.select() # Player selects a square if self.stopped(): break @@ -81,18 +80,18 @@ class GameThread(StoppableThread): graphics.state["moves"] = None # Commented out exception stuff for now, because it makes it impossible to tell if I made an IndentationError somewhere - #except Exception,e: - #result = "ILLEGAL " + e.message + except Exception,e: + result = e.message #sys.stderr.write(result + "\n") - #self.stop() - #with self.lock: - # self.final_result = self.state["turn"].colour + " " + "ILLEGAL" + self.stop() + with self.lock: + self.final_result = self.state["turn"].colour + " " + e.message if self.board.king["black"] == None: if self.board.king["white"] == None: with self.lock: - self.final_result = "DRAW" + self.final_result = self.state["turn"].colour + " DRAW" else: with self.lock: self.final_result = "white"