Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON Create a class that represents a deck of playing cards. The data for this object will be the cards themselves. The methods this class

PYTHON

Create a class that represents a deck of playing cards. The data for this object will be the cards themselves. The methods this class will have are the following

deal - a method that returns the value of the card on top of the deck. Once a card is dealt it cannot be dealt again until the deck is shuffled.

shuffle - a method that returns to the deck all dealt cards (for a total of 52, no Jokers) and places it in a random order.

fan - fan is a method that will simply list the cards in the deck from the top card to the card on the bottom of the deck.

isOrdered - a method that returns True if the deck is in order and False if it is not. If an ordered deck has a few cards dealt off of the top it is still in order. You do not need a full deck to be in order.

Order - a method that sorts the deck or puts the cards in order with the 2 of clubs beings lowest and the ace of spades being highest (while there is no real ranking of suits well go with the standard poker/bridge ranking of clubs (lowest), diamonds, hearts, spades(highest). We will also count the Ace as a high card and not a low card. The Ace of a particular suit should be the highest card when a suit is sorted (2 thru A). To make it simple, a sorted deck is the following

2C, 3C, 4C, 5C, 6C, 7C, 8C, 9C, 10C, JC, QC, KC, AC, 2D, 3D, 4D, 5D, 6D, 7D, 8D, 9D, 10D, JD, QD, KD, AD, 2H, 3H, 4H, 5H, 6H, 7H, 8H, 9H, 10H, JH, QH, KH, AH, 2S, 3S, 4S, 5S, 6S, 7S, 8S, 9S, 10S, JS, QS, KS, AS

Use your deck of cards object from the above to play Acey Duecy. Make it interactive and have the player get two cards, give an amount to wager, and then get the third card and a decision whether they have won or lost. Don't bother with ties, consider them a loss and you can consider an Ace either high or low, but not both.

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions