Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python code please: War Card Game (1.15degree of difficulty) Create a CSV file with 52 playing cards. Read the file and create a 2 dimensional

python code please:

War Card Game (1.15degree of difficulty)

Create a CSV file with 52 playing cards. Read the file and create a 2 dimensional table. Each card will have a value equivalent to its face name except face cards. The face cards will be J = 11, Q = 12, K = 13, A = 14. Create a separate array as an index for the deck. Use the random shuffle function to shuffle the cards. From that there will be multiple routines that perform the functions:

Deal a card each for two players until each has 26 cards. Whoever has revealed the highest card is the winner. After the cards are placed, there must be a winner determined (Player 1 or Player 2). If the cards are of equal value, you must indicate that you declare war and deal one card for each player until you get to the fourth card in this fashion:

I Declare War

Player 1 Player 2

2 Hearts 5 Diamonds

K Hearts 2 Clubs

10 Spades 9 Diamonds

6 Clubs 5 Spades

The last card dealt determines the winner. In this case it will be the 6 of clubs. The winner of each hand keeps the cards played for that hand.

The winner of the game is determined when one player has all of the cards. Upon completion of each game, you must give the option to restart by reshuffling and dealing two new cards or ending the game.

Keep track of wins and losses of the player. Display totals.

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

Step: 3

blur-text-image

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions