Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

rpip/poker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Poker

A Poker deck library

iex> Poker.ranking(~w[2S 3S 4S 5S 6S])
:straight_flush
iex> Poker.rank(black: ~w(3H 3D 3S 9C KD), white: ~w(2C 3H 4S 8C AH))
Black wins - three of a kind

How it works

Watch this video on how to play Poker.

How to Play Poker - Basics

Ranking algorithms

  • straight flush - any five cards in sequence of the same suit. e.g: 6S, 7S, 8S, 9S, 10S. TIE: In this case, the player with the highest card wins
  • four of a kind - four cards of the same rank, such as four kings. Also called quads
  • full house - three cards of one rank plus two cards of another rank. Called Jacks Full of Nines
  • flush - five cards of the same suit (but not a straight flush)
  • straight - any five numbered cards in sequence, that are not of the same suit.
  • three of a kind - 3 cards of the same number, and the other two don’t match each other. Also called trip
  • two pairs - Out of five cards, you have two pairs
  • pair - out of five cards you have 1 pair
  • high card - none of the above

Each algorithm has an associated tie breaker implemented in Elixir for breaking ties.

See ./lib/poker/tie_breaker/

Installation

If available in Hex, the package can be installed by adding poker to your list of dependencies in mix.exs:

def deps do
  [
    {:poker, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/poker.

Releases

No releases published

Packages

No packages published

Languages