gym_splendor_code/envs/graphics/splendor_gui.py
def draw_players_hand(self,
                              players_hand: PlayersHand,
                              x_coord: int,
                              y_coord: int,
                              active: bool,
                              state: State) -> None:
            """Draws a players hands in a given position.
            Parameters:
            _ _ _ _ _ _
            players_hand: A players hand to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            draw_reserved_buttons: Determines if draw action buy reserved button on reserved cards."""

            if active:
                players_name_font = PLAYERS_NAME_FONT_ACTIVE
            else:
                players_name_font = PLAYERS_NAME_FONT

            self.main_canvas.create_text(x_coord + PLAYERS_NAME_X, y_coord + PLAYERS_NAME_Y,
                                         text=players_hand.name, font=players_name_font)

            self.main_canvas.create_text(x_coord + PLAYERS_POINTS_X, y_coord + PLAYERS_POINTS_Y,
                                         text=PLAYERS_POINTS_TITLE + str(players_hand.number_of_my_points()),
                                         font=players_name_font)

            card_position_x_dict = {gem_color: gem_color.value * PLAYERS_HAND_HORIZONTAL_SHIFT for gem_color in GemColor if
                                    gem_color != GemColor.GOLD}

            cards_presented = {gem_color: set() for gem_color in GemColor}
            # Draw all cards:
            for card in players_hand.cards_possessed:
                card_x_coord = PLAYERS_HAND_INITIAL_X + card_position_x_dict[card.discount_profit]
                card_y_coord = PLAYERS_HAND_INITIAL_Y + len(
                    cards_presented[card.discount_profit]) * PLAYERS_HAND_VERTICAL_SHIFT
                self.draw_card(card, x_coord + card_x_coord, y_coord + card_y_coord, False, False, state)
                cards_presented[card.discount_profit].add(card)
            # Draw all reserved cards:
            self.main_canvas.create_text(x_coord + RESERVED_CARDS_TITLE_X,
                                         y_coord + RESERVED_CARDS_TITLE_Y, text="Reserved cards:",
                                         font=RESERVED_CARDS_FONT)
            self.main_canvas.create_rectangle(x_coord + RESERVED_RECTANGLE_LEFT_TOP_X,
                                              y_coord + RESERVED_RECTANGLE_LEFT_TOP_Y,
                                              x_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_X,
                                              y_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_Y,
                                              outline=RESERVED_RECTANGLE_OUTLINE)
            reserved_cards_presented = set()
            for card in players_hand.cards_reserved:
                card_x_coord = RESERVED_CARDS_INITIAL_X + len(reserved_cards_presented) * RESERVED_CARDS_HORIZONTAL_SHIFT
                card_y_coord = RESERVED_CARDS_INITIAL_Y
                self.draw_card(card, x_coord + card_x_coord, y_coord + card_y_coord, players_hand.can_afford_card(card) and
                               active, False, state)
                reserved_cards_presented.add(card)

            # Draw gems possessed by the player:
            self.draw_gems(players_hand.gems_possessed, x_coord + PLAYERS_HAND_GEMS_X, y_coord + PLAYERS_HAND_GEMS_Y)

            #Draw nobles possessed by the player
            height_indicator = 0
            for i, noble_card in enumerate(players_hand.nobles_possessed):
                self.draw_noble(noble_card, x_coord + PLAYERS_NOBLES_X, y_coord + PLAYERS_NOBLES_Y + i*PLAYERS_NOBLES_SHIFT)
Draws a players hands in a given position.
            Parameters:
            _ _ _ _ _ _
            players_hand: A players hand to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            draw_reserved_buttons: Determines if draw action buy reserved button on reserved cards.
Draws a players hands in a given position.
Parameters:
players_hand: A players hand to draw.
x_coord: Horizontal coordinate (from left top corner).
y_coord: Vertical coordinate (from left top corner).
draw_reserved_buttons: Determines if draw action buy reserved button on reserved cards.
Draws a players hands in a given position . Parameters : players_hand : A players hand to draw . x_coord : Horizontal coordinate ( from left top corner ) . y_coord : Vertical coordinate ( from left top corner ) . draw_reserved_buttons : Determines if draw action buy reserved button on reserved cards .
def draw_players_hand(self,
                              players_hand: PlayersHand,
                              x_coord: int,
                              y_coord: int,
                              active: bool,
                              state: State) -> None:
            if active:
                players_name_font = PLAYERS_NAME_FONT_ACTIVE
            else:
                players_name_font = PLAYERS_NAME_FONT
            self.main_canvas.create_text(x_coord + PLAYERS_NAME_X, y_coord + PLAYERS_NAME_Y,
                                         text=players_hand.name, font=players_name_font)
            self.main_canvas.create_text(x_coord + PLAYERS_POINTS_X, y_coord + PLAYERS_POINTS_Y,
                                         text=PLAYERS_POINTS_TITLE + str(players_hand.number_of_my_points()),
                                         font=players_name_font)
            card_position_x_dict = {gem_color: gem_color.value * PLAYERS_HAND_HORIZONTAL_SHIFT for gem_color in GemColor if
                                    gem_color != GemColor.GOLD}
            cards_presented = {gem_color: set() for gem_color in GemColor}
            for card in players_hand.cards_possessed:
                card_x_coord = PLAYERS_HAND_INITIAL_X + card_position_x_dict[card.discount_profit]
                card_y_coord = PLAYERS_HAND_INITIAL_Y + len(
                    cards_presented[card.discount_profit]) * PLAYERS_HAND_VERTICAL_SHIFT
                self.draw_card(card, x_coord + card_x_coord, y_coord + card_y_coord, False, False, state)
                cards_presented[card.discount_profit].add(card)
            self.main_canvas.create_text(x_coord + RESERVED_CARDS_TITLE_X,
                                         y_coord + RESERVED_CARDS_TITLE_Y, text="Reserved cards:",
                                         font=RESERVED_CARDS_FONT)
            self.main_canvas.create_rectangle(x_coord + RESERVED_RECTANGLE_LEFT_TOP_X,
                                              y_coord + RESERVED_RECTANGLE_LEFT_TOP_Y,
                                              x_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_X,
                                              y_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_Y,
                                              outline=RESERVED_RECTANGLE_OUTLINE)
            reserved_cards_presented = set()
            for card in players_hand.cards_reserved:
                card_x_coord = RESERVED_CARDS_INITIAL_X + len(reserved_cards_presented) * RESERVED_CARDS_HORIZONTAL_SHIFT
                card_y_coord = RESERVED_CARDS_INITIAL_Y
                self.draw_card(card, x_coord + card_x_coord, y_coord + card_y_coord, players_hand.can_afford_card(card) and
                               active, False, state)
                reserved_cards_presented.add(card)
            self.draw_gems(players_hand.gems_possessed, x_coord + PLAYERS_HAND_GEMS_X, y_coord + PLAYERS_HAND_GEMS_Y)
            height_indicator = 0
            for i, noble_card in enumerate(players_hand.nobles_possessed):
                self.draw_noble(noble_card, x_coord + PLAYERS_NOBLES_X, y_coord + PLAYERS_NOBLES_Y + i*PLAYERS_NOBLES_SHIFT)
def draw_players_hand ( self , players_hand : PlayersHand , x_coord : int , y_coord : int , active : bool , state : State ) -> None : if active : players_name_font = PLAYERS_NAME_FONT_ACTIVE else : players_name_font = PLAYERS_NAME_FONT self . main_canvas . create_text ( x_coord + PLAYERS_NAME_X , y_coord + PLAYERS_NAME_Y , text = players_hand . name , font = players_name_font ) self . main_canvas . create_text ( x_coord + PLAYERS_POINTS_X , y_coord + PLAYERS_POINTS_Y , text = PLAYERS_POINTS_TITLE + str ( players_hand . number_of_my_points ( ) ) , font = players_name_font ) card_position_x_dict = { gem_color : gem_color . value * PLAYERS_HAND_HORIZONTAL_SHIFT for gem_color in GemColor if gem_color != GemColor . GOLD } cards_presented = { gem_color : set ( ) for gem_color in GemColor } for card in players_hand . cards_possessed : card_x_coord = PLAYERS_HAND_INITIAL_X + card_position_x_dict [ card . discount_profit ] card_y_coord = PLAYERS_HAND_INITIAL_Y + len ( cards_presented [ card . discount_profit ] ) * PLAYERS_HAND_VERTICAL_SHIFT self . draw_card ( card , x_coord + card_x_coord , y_coord + card_y_coord , False , False , state ) cards_presented [ card . discount_profit ] . add ( card ) self . main_canvas . create_text ( x_coord + RESERVED_CARDS_TITLE_X , y_coord + RESERVED_CARDS_TITLE_Y , text = "Reserved cards:" , font = RESERVED_CARDS_FONT ) self . main_canvas . create_rectangle ( x_coord + RESERVED_RECTANGLE_LEFT_TOP_X , y_coord + RESERVED_RECTANGLE_LEFT_TOP_Y , x_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_X , y_coord + RESERVED_RECTANGLE_RIGHT_BOTTOM_Y , outline = RESERVED_RECTANGLE_OUTLINE ) reserved_cards_presented = set ( ) for card in players_hand . cards_reserved : card_x_coord = RESERVED_CARDS_INITIAL_X + len ( reserved_cards_presented ) * RESERVED_CARDS_HORIZONTAL_SHIFT card_y_coord = RESERVED_CARDS_INITIAL_Y self . draw_card ( card , x_coord + card_x_coord , y_coord + card_y_coord , players_hand . can_afford_card ( card ) and active , False , state ) reserved_cards_presented . add ( card ) self . draw_gems ( players_hand . gems_possessed , x_coord + PLAYERS_HAND_GEMS_X , y_coord + PLAYERS_HAND_GEMS_Y ) height_indicator = 0 for i , noble_card in enumerate ( players_hand . nobles_possessed ) : self . draw_noble ( noble_card , x_coord + PLAYERS_NOBLES_X , y_coord + PLAYERS_NOBLES_Y + i * PLAYERS_NOBLES_SHIFT )
Draws a players hands in a given position.
Draws a players hands in a given position .
"""Draws a players hands in a given position.
            Parameters:
            _ _ _ _ _ _
            players_hand: A players hand to draw.
            x_coord: Horizontal coordinate (from left top corner).
            y_coord: Vertical coordinate (from left top corner).
            draw_reserved_buttons: Determines if draw action buy reserved button on reserved cards.""" # Draw all cards: # Draw all reserved cards: # Draw gems possessed by the player: #Draw nobles possessed by the player
self
players_hand
PlayersHand
x_coord
int
y_coord
int
active
bool
state
State