Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There are two additional codes that question gave me: war_class and play_class:

ID: 3717993 • Letter: T

Question

There are two additional codes that question gave me: war_class and play_class:

https://drive.google.com/open?id=1Hkt5J1X5ZftIM8w2lsJjcv_FoyffOU__

https://drive.google.com/open?id=189z_rIcpXeOPP9svM9vDbbp92YSFA2Xt

please write the code in python and start with:

Part III: Play One Round (20 points) Complete the function play normal.round ), which takes twos arguments, in this order: 1, player 1: a Player object that represents Player #1 2, player 2: a Player object that represents Player #2 Each Player object has equal number of Card objects in its cards attribute. The function draws cards from each player's hand (use the draw.card) method in the Player class) until a player wins the round or the players run out of cards. Here is an example of how you might have Player #1 draw a card: playeri-card player1.draw-card() = If, on the first draw, the rank of Player #1's card is greater than the rank of Player #2's card, then Player #1 wins the round and the function returns the tuple ( 1, 2) , where l indicates Player #1 and 2 indicates the points won by the player. The function also adds 2 to player 1-score. As in the real War card game, Player #1 earns 2 points because he "wins" two cards: his own, as well as Player #2's card. The cards are discarded and are not added to either player's card list. Similarly, if the rank of Player #2's card is greater than the rank of Player #1's card, then Player #2 wins the round and the function returns the tuple (2, 2) . The function also adds 2 to player2. score. Here is an example: CSE 101-Spring 2018 Homework # Page 3 Player 1 drew Player 2 drew 8 Player 1 won the round, scoring 2 points. If the two cards have the same rank, then we have a war! The function draws another card from each player's hand (if any). Cards are continually drawn until the players run out of cards or one player wins the war by drawing a card of higher rank than the other player. Each draw of the cards earns the eventual winner 2 additional points. Here is an example:

Explanation / Answer

def play_normal_round(p1,p2):
    tie = 0
    while(True):
       if len(p1._cards) == 0 || len(p2._cards) == 0:
          break
       p1_card = p1.draw_card()
       p2_card = p2.draw_card()
       str1 = str(p1_card._rank)
       if p1_card._suit == 0:
          str1 = str1 + " CLUBS"
       if p1_card._suit == 1:
          str1 = str1 + " SPADES"
       if p1_card._suit == 2:
          str1 = str1 + " DIAMONDS"
       if p1_card._suit == 3:
          str1 = str1 + " HEARTS"
       str2 = str(p2_card._rank)
       if p2_card._suit == 0:
          str2 = str2 + " CLUBS"
       if p2_card._suit == 1:
          str2 = str2 + " SPADES"
       if p2_card._suit == 2:
          str2 = str2 + " DIAMONDS"
       if p2_card._suit == 3:
          str2 = str2 + " HEARTS"
       print("Player 2 drew " + str2)
       if p1_card._rank > p2_card._rank:
          p1._score = p1._score + 2 + tie * 2
          print("Player 1 won the round, scoring", p1._score, "points")
          tuple1 = (1,p1._score)
          return tuple1
          break
       if p1_card._rank < p2_card._rank:
          p2._score = p2._score + 2 + tie * 2
          print("Player 2 won the round, scoring", p2._score, "points")
          tuple2 = (2,p2._score)
          return tuple2
          break
       if p1_card._rank == p2_card._rank:
          tie = tie + 1
          print("WAR!")
      
   
    tuple3 = (0,0)
    return tuple3