Skip to content

Nerada/katas.win.playing_cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playing Cards Build Status

Practicing test driven development.

Details

http://www.tddbuddy.com/katas/Poker%20Hands.pdf

Playing Cards TDD Kata


  1. 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

  1. 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"

  1. 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

  1. Expand the game to support 2-8 players

Result

ChangeLog

0.1.0 First working version