def set_dests(self): dests = {} promotions = [] moves = self.board.legal_moves() # print("self.board.legal_moves()", moves) if self.random_mover: self.random_move = random.choice(moves) if moves else "" # print("RM: %s" % self.random_move) for move in moves: if self.variant in GRANDS: move = grand2zero(move) source, dest = move[0:2], move[2:4] if source in dests: dests[source].append(dest) else: dests[source] = [dest] if not move[-1].isdigit(): if not (self.variant in ("seirawan", "shouse") and (move[1] == '1' or move[1] == '8')): promotions.append(move) if self.variant == "kyotoshogi" and move[0] == "+": promotions.append(move) self.dests = dests self.promotions = promotions
def set_dests(self): dests = {} promotions = [] moves = self.board.legal_moves() # print("self.board.legal_moves()", moves) if self.random_mover: self.random_move = random.choice(moves) if moves else "" # print("RM: %s" % self.random_move) for move in moves: if self.variant[-5:] == "shogi": move = usi2uci(move) elif self.variant == "xiangqi" or self.variant == "grand" or self.variant == "grandhouse" or self.variant == "shako": move = grand2zero(move) source, dest = move[0:2], move[2:4] if source in dests: dests[source].append(dest) else: dests[source] = [dest] if not move[-1].isdigit(): promotions.append(move) self.dests = dests self.promotions = promotions
def get_dests(board): dests = {} promotions = [] moves = board.legal_moves() for move in moves: if board.variant in GRANDS: move = grand2zero(move) source, dest = move[0:2], move[2:4] if source in dests: dests[source].append(dest) else: dests[source] = [dest] if not move[-1].isdigit(): if not (board.variant in ("seirawan", "shouse") and (move[1] in ('1', '8'))): promotions.append(move) if board.variant in ("kyotoshogi", "chennis") and move[0] == "+": promotions.append(move) return (dests, promotions)
def get_dests(board): dests = {} promotions = [] moves = board.legal_moves() for move in moves: if board.variant in ("xiangqi", "grand", "grandhouse", "shako", "janggi"): move = grand2zero(move) source, dest = move[0:2], move[2:4] if source in dests: dests[source].append(dest) else: dests[source] = [dest] if not move[-1].isdigit(): if not (board.variant in ("seirawan", "shouse") and (move[1] == '1' or move[1] == '8')): promotions.append(move) if board.variant == "kyotoshogi" and move[0] == "+": promotions.append(move) return (dests, promotions)