Skip to content

Instantly share code, notes, and snippets.

@misterspeedy
Created October 8, 2013 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misterspeedy/6890413 to your computer and use it in GitHub Desktop.
Save misterspeedy/6890413 to your computer and use it in GitHub Desktop.
Outcome of comparing two hands
/// The possible outcomes when comparing two Poker hands.
type Outcome = Win | Draw | Lose
with
static member FromRanks (rank1 : Rank) (rank2 : Rank) =
let sortValue1, sortValue2 = rank1.SortValue, rank2.SortValue
if sortValue1 > sortValue2 then
Win
elif sortValue1 < sortValue2 then
Lose
else
Draw
override o.ToString() =
match o with
| Win -> "Win" | Draw -> "Draw" | Lose -> "Lose"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment