''' DS2000 Fall 2024 Sample code from lecture -- the morning section card game! Can it beat (creativity, fun-ness, etc.) the afternoon section???? LET'S FIND OUT Morning Section Game - War (except sounds so mean, let's call it Treaty or something nicer) Aim is to get more points Felix vs. Laney Rules: - each player gets a card - player with higher-value card gets a point - if tied, go again, and accumulate one more point - repeat until tie broken - repeat until deck is empty - whoever has the most points wins! - unless it's Felix, because they must have cheated ''' from deck import Deck def main(): # Initialize everything for our game - everyone starts with zero points, # and we need a deck of cards p1 = 0 p2 = 0 card_deck = Deck() # Shuffle the deck! card_deck.shuffle() # Play the game!!!! Each player gets a card, and the higher value wins the round # In case of a tie, go again and accumulate another point when there is finally a winnetr points = 1 while len(card_deck.cards) > 1: p1_card = card_deck.deal() p2_card = card_deck.deal() if p1_card.val > p2_card.val: print("Laney wins this round, with", points, "points") p1 += points points = 1 elif p1_card.val < p2_card.val: print("Felix cheated and won this round :( with", points, "points") p2 += points points = 1 else: print("This was a tie!") points += 1 # Communicate the end - who won/lost (laney won, probably) print("Laney has", p1, "points...") print("Felix has", p2, "points...") if p1 > p2: print("Laney Wins!!!!") elif p1 < p2: print("Laney loses, because Felix cheated :(") else: print("Tie!") main()