Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LINK TO ALL NECESSARY FILES: https://cse.msu.edu/~cse231/Online/Labs/Lab10/ Please create the codes output as reflected in the test output. Thank you. Part B: Programming with the Class

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

LINK TO ALL NECESSARY FILES: https://cse.msu.edu/~cse231/Online/Labs/Lab10/

Please create the codes output as reflected in the test output. Thank you.

Part B: Programming with the Class Method:s Consider the program in the file named lab10b.py", which imports the module containing the Card and Deck classes. Extend that program to play the card game named War". Note: you may not modify the contents of "cards.??" (the Card and Deck classes). Game Rules (Simple Version) War is a two-player game which uses a standard deck of 52 cards. Suits are ignored in the game, and the cards are ordered as follows: Ace King Queen Jack 1098765 4 3 2 (Aces are the highest cards) The cards are distributed to the two players one at a time (altenating), until both players have a stack of 26 cards Each player turns over the top card on his stack (a battle). Whoever played the card with the highest rank wins the battle and adds both cards to the bottom of his stack. In the simple version, if both cards have the same rank, each player simply returns his card to the bottom of his own stack (the battle wasa stalemate). Play continues until one player has all 52 cards in his stack and wins the game. Programming Notes 1. After dealing out the cards, your program will repeatedly process one battle. After each battle, your program will ask the user if he wishes to continue or not (make sure that simply touching the Enter key is the default and means "continue"). Stop only if "n" or "N" is entered. For each battle, your program will display the card played by each player, announce the result of the battle, and display each player's stack of cards. If one player wins the game as the result of the battle, your program will announce the winner and halt. 3. After cards are played they go on the bottom of the winning hand placing your card first and then the opponents card next (this is the ordering of Testl-see output below) 4. If the user chooses to quit the game after a battle. the player with the most cards will be declared the winner Part B: Programming with the Class Method:s Consider the program in the file named lab10b.py", which imports the module containing the Card and Deck classes. Extend that program to play the card game named War". Note: you may not modify the contents of "cards.??" (the Card and Deck classes). Game Rules (Simple Version) War is a two-player game which uses a standard deck of 52 cards. Suits are ignored in the game, and the cards are ordered as follows: Ace King Queen Jack 1098765 4 3 2 (Aces are the highest cards) The cards are distributed to the two players one at a time (altenating), until both players have a stack of 26 cards Each player turns over the top card on his stack (a battle). Whoever played the card with the highest rank wins the battle and adds both cards to the bottom of his stack. In the simple version, if both cards have the same rank, each player simply returns his card to the bottom of his own stack (the battle wasa stalemate). Play continues until one player has all 52 cards in his stack and wins the game. Programming Notes 1. After dealing out the cards, your program will repeatedly process one battle. After each battle, your program will ask the user if he wishes to continue or not (make sure that simply touching the Enter key is the default and means "continue"). Stop only if "n" or "N" is entered. For each battle, your program will display the card played by each player, announce the result of the battle, and display each player's stack of cards. If one player wins the game as the result of the battle, your program will announce the winner and halt. 3. After cards are played they go on the bottom of the winning hand placing your card first and then the opponents card next (this is the ordering of Testl-see output below) 4. If the user chooses to quit the game after a battle. the player with the most cards will be declared the winner

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago