Project 3
Objectively, how does it rank?

Overview

In this project, you will continue with modeling the game of poker. In the previous project, you wrote code to rank 5-card poker hands. In this version, there are two main changes:

  1. Your code will use Object-Oriented Programming
  2. Instead of just 5-card poker hands, we will have community cards and hole cards from which to make the best possible 5-card hand.

Objectives

Part I: OOP

In an OOP program, we create some objects and then do things with those objects. In order to create objects, you first need classes that specify the properties and behavior of the objects you will create.

You should refactor your Project 2 code so that it uses classes and objects. You must have the following classes (you can have others as well, but you must have these):

Refactor your main function so that it uses Card, Deck, and Hand objects to play the game from Project 2.

Part II: Further Refactoring

AFTER you have refactored your Project 2 to use OOP, it's time to add functionality. The new game should make a simple game that draws 5 community cards from a deck and then repeatedly:

  1. Draws two new (2-card) hands from the deck (the hole cards),
  2. Shows the community cards and the hands to the player, asking them which hand is worth more (or if they have the same value), taking into account the community cards,
  3. If the player was correct, they get one point and can continue.
  4. If the player is incorrect, the game is over and the total score should be indicated.
  5. The game is also over if there are not enough cards left to play another round.

The hole cards and the community cards are combined when we compare two hands. The value of a hand is the value of the best 5-card hand that can be made from 2 hole cards and 5 community cards, combined (so, choose the best 5 card hand from 7 cards).

Here's some possible output (your program need not output exactly like this):

The community cards are: 
Q of S ; 5 of D ; 2 of S ; 6 of C ; 7 of D
Which of the following hands is worth more?
Hand A:
6 of S ; 8 of C
 or
Hand B:
4 of C ; 8 of S
Enter a or b (or SPACE to indicate they are of equal value)a
got input: a
CORRECT!!!

The community cards are: 
Q of S ; 5 of D ; 2 of S ; 6 of C ; 7 of D
Which of the following hands is worth more?
Hand A:
K of S ; 2 of H
 or
Hand B:
6 of H ; J of S
Enter a or b (or SPACE to indicate they are of equal value)b
got input: b
CORRECT!!!

The community cards are: 
Q of S ; 5 of D ; 2 of S ; 6 of C ; 7 of D
Which of the following hands is worth more?
Hand A:
9 of C ; J of D
 or
Hand B:
9 of H ; J of C
Enter a or b (or SPACE to indicate they are of equal value) 
got input:  
CORRECT!!!

New classes/methods

To support this new functionality, you must have the following new classes:

Refactor your main function so that it now uses Card, Deck, CommunityCard, and StudPokerHand objects.

Recommendations

Here are some recommendations to make the project easier to manage:

Turn it in

Turn in the project by compressing the project folder and emailing it to me. Be sure you have the honor code pledge written at the top of each python source file.

Please remember to name your project using your last name (like CassProject3) when you create it in PyCharm.