def __init__(self, password, from_address, to_address): PyChess.__init__(self) self.ports = (23, 5000) if not password: self.username = "******" else: self.username = "******" self.owner = "Lobais" self.password = password self.from_address = "The PyChess Bot <%s>" % from_address self.to_address = "Thomas Dybdahl Ahle <%s>" % to_address # Possible start times self.minutes = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) self.gains = (0, 5, 10, 15, 20) # Possible colors. None == random self.colors = (WHITE, BLACK, None) # The amount of random challenges, that PyChess sends with each seek self.challenges = 10 enableEGTB() self.sudos = set() self.ownerOnline = False self.waitingForPassword = None self.log = [] self.acceptedTimesettings = [] self.worker = None repeat_sleep(self.sendChallenges, 60 * 1)
def __init__ (self, password, from_address, to_address): PyChess.__init__(self) self.ports = (23, 5000) if not password: self.username = "******" else: self.username = "******" self.owner = "Lobais" self.password = password self.from_address = "The PyChess Bot <%s>" % from_address self.to_address = "Thomas Dybdahl Ahle <%s>" % to_address # Possible start times self.minutes = (1,2,3,4,5,6,7,8,9,10) self.gains = (0,5,10,15,20) # Possible colors. None == random self.colors = (WHITE, BLACK, None) # The amount of random challenges, that PyChess sends with each seek self.challenges = 10 enableEGTB() self.sudos = set() self.ownerOnline = False self.waitingForPassword = None self.log = [] self.acceptedTimesettings = [] self.worker = None repeat_sleep(self.sendChallenges, 60*1)
def makeReady(self): signal.signal(signal.SIGINT, Gtk.main_quit) PyChess.makeReady(self) self.connection = FICSMainConnection("freechess.org", self.ports, self.username, self.password) self.connection.connect("connectingMsg", self.__showConnectLog) self.connection._connect() self.connection.glm.connect("addPlayer", self.__onAddPlayer) self.connection.glm.connect("removePlayer", self.__onRemovePlayer) self.connection.cm.connect("privateMessage", self.__onTell) self.connection.alm.connect("logOut", self.__onLogOut) self.connection.bm.connect("playGameCreated", self.__onGameCreated) self.connection.bm.connect("curGameEnded", self.__onGameEnded) self.connection.bm.connect("boardUpdate", self.__onBoardUpdate) self.connection.om.connect("onChallengeAdd", self.__onChallengeAdd) self.connection.om.connect("onOfferAdd", self.__onOfferAdd) self.connection.adm.connect("onAdjournmentsList", self.__onAdjournmentsList) self.connection.em.connect("onAmbiguousMove", self.__onAmbiguousMove) self.connection.em.connect("onIllegalMove", self.__onAmbiguousMove) self.connection.adm.queryAdjournments() self.connection.lvm.setVariable("autoflag", 1) self.connection.fm.setFingerNote( 1, "PyChess is the chess engine bundled with the PyChess %s " % pychess.VERSION + "chess client. This instance is owned by %s, but acts " % self.owner + "quite autonomously.") self.connection.fm.setFingerNote( 2, "PyChess is 100% Python code and is released under the terms of " + "the GPL. The evalution function is largely equal to the one of" + "GnuChess, but it plays quite differently.") self.connection.fm.setFingerNote( 3, "PyChess runs on an elderly AMD Sempron(tm) Processor 3200+, 512 " + "MB DDR2 Ram, but is built to take use of 64bit calculating when " + "accessible, through the gpm library.") self.connection.fm.setFingerNote( 4, "PyChess uses a small 500 KB openingbook based solely on Kasparov " + "games. The engine doesn't have much endgame knowledge, but might " + "in some cases access an online endgamedatabase.") self.connection.fm.setFingerNote( 5, "PyChess will allow any pause/resume and adjourn wishes, but will " + "deny takebacks. Draw, abort and switch offers are accepted, " + "if they are found to be an advance. Flag is auto called, but " + "PyChess never resigns. We don't want you to forget your basic " + "mating skills.")
def __go (self): if self.worker: self.worker.cancel() self.worker = GtkWorker(lambda worker: PyChess._PyChess__go(self, worker)) self.worker.connect("published", lambda w, msg: self.extendlog(msg)) self.worker.connect("done", self.__onMoveCalculated) self.worker.execute()
def __go(self): if self.worker: self.worker.cancel() self.worker = GtkWorker( lambda worker: PyChess._PyChess__go(self, worker)) self.worker.connect("published", lambda w, msg: self.extendlog(msg)) self.worker.connect("done", self.__onMoveCalculated) self.worker.execute()
def __init__(self): PyChess.__init__(self) self.board = LBoard(NORMALCHESS) self.board.applyFen(FEN_START) self.forced = False self.analyzing = False self.thread = None self.basetime = 0 self.features = { "ping": 1, "setboard": 1, "playother": 1, "san": 1, "usermove": 1, "time": 1, "draw": 1, "sigint": 0, "sigterm": 0, "reuse": 1, "analyze": 1, "myname": "PyChess %s" % pychess.VERSION, "variants": "normal,wildcastle,nocastle,fischerandom,crazyhouse," + "losers,suicide,giveaway,horde,atomic," + "kingofthehill,3check,asean,cambodian,makruk,sittuyin", "colors": 0, "ics": 0, "name": 0, "pause": 0, # Unimplemented "nps": 0, # Unimplemented "debug": 1, "memory": 0, # Unimplemented "smp": 0, # Unimplemented "egt": "gaviota", "option": "skipPruneChance -slider 0 0 100" } python = sys.executable.split("/")[-1] python_version = "%s.%s.%s" % sys.version_info[0:3] self.print("# %s [%s %s]" % (self.features["myname"], python, python_version))
def __init__(self): PyChess.__init__(self) self.board = LBoard(NORMALCHESS) self.board.applyFen(FEN_START) self.forced = False self.analyzing = False self.thread = None self.basetime = 0 self.features = { "ping": 1, "setboard": 1, "playother": 1, "san": 1, "usermove": 1, "time": 1, "draw": 1, "sigint": 0, "sigterm": 0, "reuse": 1, "analyze": 1, "myname": "PyChess %s" % pychess.VERSION, "variants": "normal,wildcastle,nocastle,fischerandom,crazyhouse,losers,suicide,atomic," + \ "kingofthehill,3check,asean,cambodian,makruk,sittuyin", "colors": 0, "ics": 0, "name": 0, "pause": 0, # Unimplemented "nps": 0, # Unimplemented "debug": 1, "memory": 0, # Unimplemented "smp": 0, # Unimplemented "egt": "gaviota", "option": "skipPruneChance -slider 0 0 100" } python = sys.executable.split("/")[-1] python_version = "%s.%s.%s" % sys.version_info[0:3] self.print("# %s [%s %s]" % (self.features["myname"], python, python_version))
def __init__(self): PyChess.__init__(self) self.board = LBoard(NORMALCHESS) self.board.applyFen(FEN_START) self.forced = False self.analyzing = False self.thread = None self.basetime = 0 self.features = { "ping": 1, "setboard": 1, "playother": 1, "san": 1, "usermove": 1, "time": 1, "draw": 1, "sigint": 0, "sigterm": 0, "reuse": 1, "analyze": 1, "myname": "PyChess %s" % pychess.VERSION, "variants": "normal,wildcastle,nocastle,fischerandom,crazyhouse,losers,suicide,atomic,king-of-the-hill", "colors": 0, "ics": 0, "name": 0, "pause": 0, # Unimplemented "nps": 0, # Unimplemented "debug": 1, "memory": 0, # Unimplemented "smp": 0, # Unimplemented "egt": "gaviota", "option": "skipPruneChance -slider 0 0 100" }
def __init__ (self): PyChess.__init__(self) self.board = LBoard(NORMALCHESS) self.board.applyFen(FEN_START) self.forced = False self.analyzing = False self.thread = None self.basetime = 0 self.features = { "ping": 1, "setboard": 1, "playother": 1, "san": 1, "usermove": 1, "time": 1, "draw": 1, "sigint": 0, "sigterm": 0, "reuse": 1, "analyze": 1, "myname": "PyChess %s" % pychess.VERSION, "variants": "normal,wildcastle,nocastle,fischerandom,crazyhouse,losers,suicide,atomic", "colors": 0, "ics": 0, "name": 0, "pause": 0, # Unimplemented "nps": 0, # Unimplemented "debug": 1, "memory": 1, "smp": 0, # Unimplemented # "egt": "gaviota", # TODO: re-enable "option": "skipPruneChance -slider 0 0 100" }
def makeReady(self): PyChess.makeReady(self) signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTERM, self.handle_sigterm)