sys.stdout.write("SELECTION?\n")
try:
p = map(int, sys.stdin.readline().strip("\r\n ").split(" "))
+ return p
except:
sys.stderr.write("ILLEGAL GIBBERISH\n")
continue
+
# It's your move captain
def get_move(self):
if isinstance(graphics, GraphicsThread):
sys.stdout.write("MOVE?\n")
try:
p = map(int, sys.stdin.readline().strip("\r\n ").split(" "))
+ return p
except:
sys.stderr.write("ILLEGAL GIBBERISH\n")
continue
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):
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
global sleep_timeout
+ retry_illegal = False
server_addr = None
max_moves = None
sleep_timeout = -1
else:
sleep_timeout = float(arg[2:].split("=")[1])
-
+ elif (arg[1] == '-' and arg[2:] == "retry-illegal"):
+ retry_illegal = not retry_illegal
elif (arg[1] == '-' and arg[2:] == "help"):
# Help
os.system("less data/help.txt") # The best help function
board = Board(style)
board.max_moves = max_moves
game = GameThread(board, players)
+ game.retry_illegal = retry_illegal
# --- main.py --- #
-# EOF - created from make on Sun May 19 12:36:10 WST 2013
+# EOF - created from make on Thursday 20 June 18:09:07 WST 2013