Example #1
0
def gen_kings(board: Board, k, bk):
    kings = {"white": Pieces.King(board, board.get_square((board.size // 2, board.size - 1)), white, k),
             "black": Pieces.King(board, board.get_square((board.size // 2, 0)), black, bk)}

    board.white_pieces.add(kings["white"])
    board.black_pieces.add(kings["black"])
    return kings
Example #2
0
def gen_bishops(board: Board, size, i, wh, wk, bh, bk):
    board.white_pieces.add(Pieces.Bishop(
        board, board.get_square((i, size.y - 1)), white, wh, wk))
    board.white_pieces.add(Pieces.Bishop(board, board.get_square(
        (size.size - i - 1, size.y - 1)), white, wh, wk))

    board.black_pieces.add(Pieces.Bishop(
        board, board.get_square((i, 0)), black, bh, bk))
    board.black_pieces.add(Pieces.Bishop(
        board, board.get_square((size.size - i - 1, 0)), black, bh, bk))
Example #3
0
def gen_knights(board: Board, size, i, wd, wh, bd, bh):
    board.white_pieces.add(Pieces.Knight(
        board, board.get_square((i, size.y - 1)), white, wd, wh))
    board.white_pieces.add(Pieces.Knight(board, board.get_square(
        (size.size - i - 1, size.y - 1)), white, wd, wh))

    board.black_pieces.add(Pieces.Knight(
        board, board.get_square((i, 0)), black, bd, bh))
    board.black_pieces.add(Pieces.Knight(
        board, board.get_square((size.size - i - 1, 0)), black, bd, bh))
Example #4
0
def gen_rooks(board: Board, size, i, wd: bool = None, wk: bool = None, bd: bool = None, bk: bool = None):
    board.white_pieces.add(Pieces.Rook(
        board, board.get_square((i, size.y - 1)), white, wd, wk))
    board.white_pieces.add(Pieces.Rook(board, board.get_square(
        (size.size - i - 1, size.y - 1)), white, wd, wk))

    board.black_pieces.add(Pieces.Rook(
        board, board.get_square((i, 0)), black, bd, bk))
    board.black_pieces.add(Pieces.Rook(
        board, board.get_square((size.size - i - 1, 0)), black, bd, bk))
Example #5
0
def gen_queens(board: Board, wk, bk):
    board.white_pieces.add(Pieces.Queen(board, board.get_square(
        (board.size // 2 - 1, board.size - 1)), white, wk))
    board.black_pieces.add(Pieces.Queen(
        board, board.get_square((board.size // 2 - 1, 0)), black, bk))
Example #6
0
def gen_pawns(board: Board, wk, bk):
    for i in range(board.size):
        board.white_pieces.add(Pieces.Pawn(
            board, board.get_square((i, board.size - 2)), white, wk))
        board.black_pieces.add(Pieces.Pawn(
            board, board.get_square((i, 1)), black, bk))