Cards

scalation.simulation.monte_carlo.Cards
See theCards companion class
object Cards

The Cards companion object provides function that operate on cards and hands.

Attributes

See also
Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Cards.type

Members list

Value members

Concrete methods

def classify(hand: IndexedSeq[Int]): Int

Classify the Poker Hand from highest to lowest:

Classify the Poker Hand from highest to lowest:

Value parameters

hand

the card hand

Attributes

def handMap(hand: IndexedSeq[Int]): Map[Int, Int]

Turn the hand into a map of face-value -> frequency in hand, e.g., 3 Kings.

Turn the hand into a map of face-value -> frequency in hand, e.g., 3 Kings.

Value parameters

hand

the card hand

Attributes

def isFlush(hand: IndexedSeq[Int]): Boolean

Determine whether the hand is a flush (all cards have the same suit).

Determine whether the hand is a flush (all cards have the same suit).

Value parameters

hand

the card hand

Attributes

def isStraight(hmap: Map[Int, Int]): Boolean

Determine whether the hand is a straight (consecutive cards). An Ace (1) can be on either end, e.g., (A, 2, 3, 4, 5) or (10, J, Q, K, A).

Determine whether the hand is a straight (consecutive cards). An Ace (1) can be on either end, e.g., (A, 2, 3, 4, 5) or (10, J, Q, K, A).

Value parameters

hand

the card hand

Attributes

def value(c: Int): (Int, Char)

Convert the integer card number c (0 to 51) to the face value: 1(A), 2, 3, ..., 10, 11(J), 12(Q), 13(K) and suit: 0(C), 1(D), 2(H), 3(S).

Convert the integer card number c (0 to 51) to the face value: 1(A), 2, 3, ..., 10, 11(J), 12(Q), 13(K) and suit: 0(C), 1(D), 2(H), 3(S).

Value parameters

c

the card number

Attributes

Concrete fields

val htype: Array[String]
val suit: Array[Char]