예제 #1
0
    def __init__ (self, gamemodel, ichandle, gameno, color, name, icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.queue = Queue()
        self.okqueue = Queue()
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel

        # If some times later FICS creates another game with same wplayer,bplayer,gameno
        # this will change to False and boardUpdate messages will be ignored
        self.current = True

        self.connection = connection = self.gamemodel.connection
        self.connections = connections = defaultdict(list)
        connections[connection.bm].append(connection.bm.connect_after("boardUpdate", self.__boardUpdate))
        connections[connection.bm].append(connection.bm.connect_after("playGameCreated", self.__playGameCreated))
        connections[connection.bm].append(connection.bm.connect_after("obsGameCreated", self.__obsGameCreated))
        connections[connection.om].append(connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(connection.cm.connect("privateMessage", self.__onPrivateMessage))
예제 #2
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.pass_interrupt = False
        self.turn_interrupt = False

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.om].append(connection.om.connect(
            "onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(connection.om.connect(
            "onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(connection.om.connect(
            "onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(connection.cm.connect(
            "privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated", self.on_game_terminated)
예제 #3
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.pass_interrupt = False
        self.turn_interrupt = False

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.om].append(
            connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(
            connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(
            connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(
            connection.cm.connect("privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated",
                                                self.on_game_terminated)
예제 #4
0
    def __init__(self, gmwidg, color, name, ichandle=None, icrating=None):
        Player.__init__(self)

        self.defname = "Human"
        self.board = gmwidg.board
        self.gmwidg = gmwidg
        self.gamemodel = self.gmwidg.gamemodel
        self.move_queue = asyncio.Queue()
        self.color = color

        self.board_cids = [
            self.board.connect("piece_moved", self.piece_moved),
            self.board.connect("action", self.emit_action),
        ]
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating

        self.timemodel_cid = None
        if self.gamemodel.timed:
            self.timemodel_cid = self.gamemodel.timemodel.connect(
                "zero_reached", self.zero_reached
            )
        self.cid = self.gamemodel.connect_after(
            "game_terminated", self.on_game_terminated
        )
예제 #5
0
파일: Human.py 프로젝트: sally0813/pychess
 def __init__ (self, gmwidg, color, name, ichandle=None, icrating=None):
     Player.__init__(self)
     
     self.defname = "Human"
     self.board = gmwidg.board
     self.gmwidg = gmwidg
     self.gamemodel = self.board.view.model
     self.queue = Queue()
     self.color = color
     self.conid = [
         self.board.connect("piece_moved", self.piece_moved),
         self.board.connect("action", lambda b,action,param: self.emit_action(action, param))
     ]
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     
     if self.gamemodel.timed:
         self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
예제 #6
0
 def __init__ (self, gmwidg, color, name, ichandle=None, icrating=None):
     Player.__init__(self)
     
     self.defname = "Human"
     self.board = gmwidg.board
     self.gmwidg = gmwidg
     self.gamemodel = self.board.view.model
     self.queue = Queue()
     self.color = color
     self.conid = [
         self.board.connect("piece_moved", self.piece_moved),
         self.board.connect("action", lambda b,action,param: self.emit_action(action, param))
     ]
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     
     if self.gamemodel.timed:
         self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
예제 #7
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.turn_interrupt = False

        # If some times later FICS creates another game with same wplayer,bplayer,gameno
        # this will change to False and boardUpdate messages will be ignored
        self.current = True

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.bm].append(
            connection.bm.connect_after("playGameCreated",
                                        self.__playGameCreated))
        connections[connection.bm].append(
            connection.bm.connect_after("obsGameCreated",
                                        self.__obsGameCreated))
        connections[connection.om].append(
            connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(
            connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(
            connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(
            connection.cm.connect("privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated",
                                                self.on_game_terminated)
예제 #8
0
파일: Human.py 프로젝트: ME7ROPOLIS/pychess
    def __init__(self, gmwidg, color, name, ichandle=None, icrating=None):
        Player.__init__(self)

        self.defname = "Human"
        self.board = gmwidg.board
        self.gmwidg = gmwidg
        self.gamemodel = self.gmwidg.gamemodel
        self.queue = Queue()
        self.color = color

        self.board_cids = [
            self.board.connect("piece_moved", self.piece_moved),
            self.board.connect("action", self.emit_action)
        ]
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating

        if self.gamemodel.timed:
            self.timemodel_cid = self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
        self.cid = self.gamemodel.connect_after("game_terminated", self.on_game_terminated)
예제 #9
0
파일: ICPlayer.py 프로젝트: btrent/knave
 def __init__ (self, gamemodel, ichandle, gameno, color, name, icrating=None):
     Player.__init__(self)
     
     self.queue = Queue()
     self.okqueue = Queue()
     
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     self.color = color
     self.gameno = gameno
     self.gamemodel = gamemodel
     self.connection = connection = self.gamemodel.connection
     
     self.connections = connections = defaultdict(list)
     connections[connection.bm].append(connection.bm.connect_after("boardUpdate", self.__boardUpdate))
     connections[connection.om].append(connection.om.connect("onOfferAdd", self.__onOfferAdd))
     connections[connection.om].append(connection.om.connect("onOfferRemove", self.__onOfferRemove))
     connections[connection.om].append(connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
     connections[connection.cm].append(connection.cm.connect("privateMessage", self.__onPrivateMessage))
     
     self.offers = {}
예제 #10
0
파일: blunders.py 프로젝트: fowode/pychess
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue()
     self.__type__ = LOCAL
예제 #11
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue()
     self.__type__ = LOCAL
예제 #12
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue.Queue()
예제 #13
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue.Queue()