Skip to content

Evaluate the comparison of two poker hands with test cases

Notifications You must be signed in to change notification settings

Ceviche98/I2A2-First-Homework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

I2A2-First-Homework

Context

A famous casino suddenly faces a huge decline in its revenue. So the casino decides to offer a new Poker online version. Can you help them write an algorithm to ranking the Poker hands?

Notes:

  • A Poker hand is consists for 5 cards.
  • Each card has a string with 2 (two) characters.
    • The first character is the card value and it can have the values below, ranked from lowest to highest:
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • T (10)
      • J (Jack)
      • Q (Queen)
      • K (King)
      • A (Ace)
    • The second character is the card suit and it can assume the values below.
      • S (Spades)
      • H (Hearts)
      • D (Diamonds)
      • C (Clubs)
  • The rules for classifying Poker cards are listed below:

The Challenge

  1. The challenge consists in create a class that represents a Poker hand called "PokerHand" and create a method to compare it with another Poker hand. The class "PokerHand" must have a constructor that accepts a string containing 5 (five) cards. A space will used as a separator for each card. Each card consists in 2 (two) characters as previously described. Let's see an example:

    poker_hand_1 = PokerHand("KS 2H 5C JD TD") poker_hand_2 = PokerHand("9C 9H 5C 5H AC") result = poker_hand_1.compare_with(poker_hand_2) The result must be one enumerated with 2 (two) possible values that will represent the following states: WIN or LOSS.

  2. The functioning of the solution must be guaranteed through unit tests.

UNIT TEST CASES

The test cases can be verified in the jupyter notebook "I2A2 - Test N°1.ipynb". If you want to run the test cases in your console, download the file "I2A2_Test.py" and follow the instructions below:

UNIT TEXT CASES FOR "BEST HAND"

In the console paste the following line:

python3.6 -m unittest -v I2A2_Test.TestPokerHand

UNIT TEXT CASES FOR POKER HAND COMPARISON

In the console paste the following line:

python3.6 -m unittest I2A2_Test.TestPokercomparison

About

Evaluate the comparison of two poker hands with test cases

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published