Nov-24-2021, 07:38 PM
COMPARING CARD GAMES
The cards have a value of (1-13) and a suit (a, b, c, d).
so that the deck of cards consists of 52 cards.
1) first of all i created the deck:
so ..
because i cannot make any progress from this point
notation
COMPARING CARD GAMES
i) For this purpose, a function should be created that compares 2 playing cards.
ii) It should be returned whether the first card is the same size (1), smaller (0) or larger (2) than the 2nd card.
a) The function takes three arguments (1st card, 2nd card, trump suit).
b) The coded ratio (0: smaller; 1: equal; 2 larger) of the cards should be returned as the return.
* A trump card: is a card that is bigger than the others. .
The cards have a value of (1-13) and a suit (a, b, c, d).
so that the deck of cards consists of 52 cards.
1) first of all i created the deck:
def card(): value = [1,2,3,4,5,6,7,8,9,10,11,12,13] suit = ["a", "b", "c", "d"] deck= [] for i in value: for j in suit: deck.append return deck card()2) then I would compare the cards by accessing the deck
so ..
def card(): value = [1,2,3,4,5,6,7,8,9,10,11,12,13] suit = ["a", "b", "c", "d"] deck= [] for i in value: for j in suit: deck.append return deck card() x = card def compare_cards(card1,card2,trump): if card1 [1] == trump: # [1] second value should be the suite if card2 [1] == trump: if card1 [0] > card1 [0]: print (2) elif card1 [1] == trump: if card2 [1] != trump: print (2) elif card1 [1] != trump: if card2 [1] == trump: print (0) #........ compare_cards(card1,card2,trump)i feel lost

notation
COMPARING CARD GAMES
i) For this purpose, a function should be created that compares 2 playing cards.
ii) It should be returned whether the first card is the same size (1), smaller (0) or larger (2) than the 2nd card.
a) The function takes three arguments (1st card, 2nd card, trump suit).
b) The coded ratio (0: smaller; 1: equal; 2 larger) of the cards should be returned as the return.
* A trump card: is a card that is bigger than the others. .