hold-em-0.1.0.0: An engine for Texas hold'em Poker

Copyright(c) Joe Vargas 2014
LicenseBSD-style
Maintainerjxv@hush.com
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

HoldEm

Description

 

Synopsis

Documentation

data Rank

Value of a card.

Constructors

R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
Jack 
Queen 
King 
Ace 

data Suit

Family of a card.

Constructors

Clubs 
Hearts 
Diamonds 
Spades 

data Card

Combined record for Rank and Suit.

Constructors

Card 

Fields

rank :: Rank
 
suit :: Suit
 

Instances

Eq Card 
Ord Card

The Ord instance of Card compares the ranks and ignores suits.

Show Card 

data Hand

The value of a playable hand. Use its instance of Ord for comparing better hands.

Instances

type PHand = (Card, Card)

A dealt hand to a player.

type HandSet = (Card, Card, Card, Card, Card)

A set of 5 cards which can be played.

data Table

The cards on the board.

Constructors

Table 

Fields

flop :: (Card, Card, Card)
 
turn :: Card
 
river :: Card
 

Instances

deck :: [Card]

All possible cards in a deck.

bestHand :: PHand -> Table -> (Hand, HandSet)

Finds the highest scoring hand from a player's hand and the table.

deal :: RandomGen g => g -> Int -> Either String (Table, [PHand])

Generates initial data for a game. The number of players must be between 2 and 9 inclusively. And, the length of the returning [PHand] will match the number of players.