Пример #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
Пример #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))
Пример #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))
Пример #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))
Пример #5
0
def init_board(size):
    global wins, board, screen, white_diagonal_upgrades, white_horizontal_upgrades, white_knighted_upgrades, black_diagonal_upgrades, black_horizontal_upgrades, black_knighted_upgrades, kings, end, game_over, you_lose, you_win, turn
    print(white_diagonal_upgrades)
    print(white_horizontal_upgrades)
    print(white_knighted_upgrades)
    print(black_diagonal_upgrades)
    print(black_horizontal_upgrades)
    print(black_knighted_upgrades)
    end = False
    game_over = False
    you_lose = False
    you_win = False
    turn = True
    size = 2 * size + 6
    board = Board.Board(size)
    screen = board.create_board()
    kings = board_gen.gen_board(board, white_diagonal_upgrades, white_horizontal_upgrades, white_knighted_upgrades,
                                black_diagonal_upgrades, black_horizontal_upgrades, black_knighted_upgrades)
Пример #6
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))
Пример #7
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))