Practicing test driven development.
http://www.tddbuddy.com/katas/Poker%20Hands.pdf
- Write a function that takes a string representing 5 playing cards and returns the highest scoring card.
- Input 5 space delimited strings
- Each string is comprised of two parameters:
- value 2,3,4,5,6,7,8,9,10,J,Q,K,A
- suit C,D,H,S
- e.g.
2C = Two of clubs
QS = Queen of spades - "2H 3D 5S 9C KD" should result in the KD card
- Create a function that takes two players and reports the winner and their winning card. The winner is the player with highest card.
- e.g. "2H 3D 5S 9C QD", "2C 3H 4S 8C KH" -> "2C 3H 4S 8C KH", "KH"
- e.g. "2H 3D 5S 9C QD", "2C 3H 4S 8C KH" -> "2C 3H 4S 8C KH", "KH"
- Expand the solution to calculate and evaluate winning hands based on poker hands
High card, Pair, Two Pair, Three of a kind, Straight, Flush, Full house, Four of a kind, Straight flush, Royal flush
e.g.
Player 1 | Player 2 | Result |
---|---|---|
2H 3D 5S 9C KD | 2C 3H 4S 8C AH | Player 2 wins - with high card: Ace |
2H 4S 4C 2D 4H | 2S 8S AS QS 3S | Player 1 wins - with full house: 4 over 2 |
2H 3D 5S 9C QD | 2C 3H 4S 8C KH | Player 2 wins - with high card: king |
2H 3D 5S 9C KD | 2D 3H 5C 9S KH | Tie |
- Expand the game to support 2-8 players
0.1.0 First working version