gym_splendor_code/envs/graphics/splendor_gui.py
def draw_board(self,
                       board: Board,
                       x_coord: int,
                       y_coord: int,
                       state: State) -> None:

            """Draws the board, that is: cards that lie on the table, nobles that lie on the table and coins.
            Parameters:
            _ _ _ _ _ _
            board: Board to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            active_players_hand: The hand of the player that is currently active. This argument is optional and is used to
            determine which cards should be given buy or reserve buttons. If the value is None no buttons are drawn."""

            self.board_x_ccord = x_coord
            self.board_y_ccord = y_coord

            self.main_canvas.create_text(x_coord + BOARD_TITLE_POSITION_X, y_coord + BOARD_TITLE_POSITION_Y,
                                         fill=BOARD_NAME_FONT_COLOR, text=BOARD_TITLE, font=BOARD_NAME_FONT)

            # dictionary used to keep track of drawn cards
            cards_already_drawn = {row: set() for row in Row}
            for card in board.cards_on_board:
                position_x = HORIZONTAL_CARD_DISTANCE * len(cards_already_drawn[card.row])
                cards_already_drawn[card.row].add(card)
                self.draw_card(card, x_coord + position_x, y_coord + VERTICAL_CARD_DISTANCE * POSITION_Y_DICT[card.row],
                               state.active_players_hand().can_afford_card(card),
                               state.active_players_hand().can_reserve_card(), state)

            for position_index, noble_card in enumerate(board.nobles_on_board):
                position_x = NOBLES_START_X + x_coord + HORIZONTAL_NOBLE_DISTANCE * position_index
                position_y = NOBLES_START_Y + y_coord
                self.draw_noble(noble_card, position_x, position_y)

            self.draw_gems(board.gems_on_board, x_coord + GEMS_BOARD_X, y_coord + GEMS_BOARD_Y)

            if self.interactive:
                for gem_color in GemColor:
                    gem_entry = Entry(self.main_window)
                    gem_entry.place(x=x_coord + GEM_ENTRY_SHIFT * gem_color.value + GEMS_ENTRY_INITIAL_X,
                                    y=y_coord + GEMS_ENTRY_INITIAL_Y, width=GEM_ENTRY_WIDTH)
                    self.entries[gem_color] = gem_entry
                    self.drawn_buttons.add(gem_entry)
                self.set_entries(GemsCollection())
                trade_button = Button(text=TRADE_BUTTON_TITLE, font=TRADE_BUTTON_FONT,
                                      command=lambda: self.set_action(ActionTradeGems(self.read_entries())))
                trade_button.place(x=x_coord + TRADE_BUTTON_X, y=y_coord + TRADE_BUTTON_Y)
                self.drawn_buttons.add(trade_button)
Draws the board, that is: cards that lie on the table, nobles that lie on the table and coins.
            Parameters:
            _ _ _ _ _ _
            board: Board to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            active_players_hand: The hand of the player that is currently active. This argument is optional and is used to
            determine which cards should be given buy or reserve buttons. If the value is None no buttons are drawn.
Draws the board, that is: cards that lie on the table, nobles that lie on the table and coins.
Parameters:
board: Board to draw.
x_coord: Horizontal coordinate (from left top corner).
y_coord: Vertical coordinate (from left top corner).
active_players_hand: The hand of the player that is currently active. This argument is optional and is used to
determine which cards should be given buy or reserve buttons. If the value is None no buttons are drawn.
Draws the board that is : cards that lie on the table nobles that lie on the table and coins . Parameters : board : Board to draw . x_coord : Horizontal coordinate ( from left top corner ) . y_coord : Vertical coordinate ( from left top corner ) . active_players_hand : The hand of the player that is currently active . This argument is optional and is used to determine which cards should be given buy or reserve buttons . If the value is None no buttons are drawn .
def draw_board(self,
                       board: Board,
                       x_coord: int,
                       y_coord: int,
                       state: State) -> None:
            self.board_x_ccord = x_coord
            self.board_y_ccord = y_coord
            self.main_canvas.create_text(x_coord + BOARD_TITLE_POSITION_X, y_coord + BOARD_TITLE_POSITION_Y,
                                         fill=BOARD_NAME_FONT_COLOR, text=BOARD_TITLE, font=BOARD_NAME_FONT)
            cards_already_drawn = {row: set() for row in Row}
            for card in board.cards_on_board:
                position_x = HORIZONTAL_CARD_DISTANCE * len(cards_already_drawn[card.row])
                cards_already_drawn[card.row].add(card)
                self.draw_card(card, x_coord + position_x, y_coord + VERTICAL_CARD_DISTANCE * POSITION_Y_DICT[card.row],
                               state.active_players_hand().can_afford_card(card),
                               state.active_players_hand().can_reserve_card(), state)
            for position_index, noble_card in enumerate(board.nobles_on_board):
                position_x = NOBLES_START_X + x_coord + HORIZONTAL_NOBLE_DISTANCE * position_index
                position_y = NOBLES_START_Y + y_coord
                self.draw_noble(noble_card, position_x, position_y)
            self.draw_gems(board.gems_on_board, x_coord + GEMS_BOARD_X, y_coord + GEMS_BOARD_Y)
            if self.interactive:
                for gem_color in GemColor:
                    gem_entry = Entry(self.main_window)
                    gem_entry.place(x=x_coord + GEM_ENTRY_SHIFT * gem_color.value + GEMS_ENTRY_INITIAL_X,
                                    y=y_coord + GEMS_ENTRY_INITIAL_Y, width=GEM_ENTRY_WIDTH)
                    self.entries[gem_color] = gem_entry
                    self.drawn_buttons.add(gem_entry)
                self.set_entries(GemsCollection())
                trade_button = Button(text=TRADE_BUTTON_TITLE, font=TRADE_BUTTON_FONT,
                                      command=lambda: self.set_action(ActionTradeGems(self.read_entries())))
                trade_button.place(x=x_coord + TRADE_BUTTON_X, y=y_coord + TRADE_BUTTON_Y)
                self.drawn_buttons.add(trade_button)
def draw_board ( self , board : Board , x_coord : int , y_coord : int , state : State ) -> None : self . board_x_ccord = x_coord self . board_y_ccord = y_coord self . main_canvas . create_text ( x_coord + BOARD_TITLE_POSITION_X , y_coord + BOARD_TITLE_POSITION_Y , fill = BOARD_NAME_FONT_COLOR , text = BOARD_TITLE , font = BOARD_NAME_FONT ) cards_already_drawn = { row : set ( ) for row in Row } for card in board . cards_on_board : position_x = HORIZONTAL_CARD_DISTANCE * len ( cards_already_drawn [ card . row ] ) cards_already_drawn [ card . row ] . add ( card ) self . draw_card ( card , x_coord + position_x , y_coord + VERTICAL_CARD_DISTANCE * POSITION_Y_DICT [ card . row ] , state . active_players_hand ( ) . can_afford_card ( card ) , state . active_players_hand ( ) . can_reserve_card ( ) , state ) for position_index , noble_card in enumerate ( board . nobles_on_board ) : position_x = NOBLES_START_X + x_coord + HORIZONTAL_NOBLE_DISTANCE * position_index position_y = NOBLES_START_Y + y_coord self . draw_noble ( noble_card , position_x , position_y ) self . draw_gems ( board . gems_on_board , x_coord + GEMS_BOARD_X , y_coord + GEMS_BOARD_Y ) if self . interactive : for gem_color in GemColor : gem_entry = Entry ( self . main_window ) gem_entry . place ( x = x_coord + GEM_ENTRY_SHIFT * gem_color . value + GEMS_ENTRY_INITIAL_X , y = y_coord + GEMS_ENTRY_INITIAL_Y , width = GEM_ENTRY_WIDTH ) self . entries [ gem_color ] = gem_entry self . drawn_buttons . add ( gem_entry ) self . set_entries ( GemsCollection ( ) ) trade_button = Button ( text = TRADE_BUTTON_TITLE , font = TRADE_BUTTON_FONT , command = lambda : self . set_action ( ActionTradeGems ( self . read_entries ( ) ) ) ) trade_button . place ( x = x_coord + TRADE_BUTTON_X , y = y_coord + TRADE_BUTTON_Y ) self . drawn_buttons . add ( trade_button )
Draws the board, that is: cards that lie on the table, nobles that lie on the table and coins.
Draws the board that is : cards that lie on the table nobles that lie on the table and coins .
"""Draws the board, that is: cards that lie on the table, nobles that lie on the table and coins.
            Parameters:
            _ _ _ _ _ _
            board: Board to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            active_players_hand: The hand of the player that is currently active. This argument is optional and is used to
            determine which cards should be given buy or reserve buttons. If the value is None no buttons are drawn.""" # dictionary used to keep track of drawn cards
self
board
Board
x_coord
int
y_coord
int
state
State