All Downloads are FREE. Search and download functionalities are using the official Maven repository.

classes.hand.Hand.scala Maven / Gradle / Ivy

Go to download

Scala library for card-playing functionality, including games Blackjack and Thirty-One

The newest version!
package cards.classes.hand

import cards.classes.{ Card, Rank, Suit, Deck }
import cards.classes.actions.Action

// bets (if applicable to the game): bets placed on the hand (map with player id as key and bet placed as value)
// owners (if applicable to the game): i.e. poker hands often consist of face-down cards (seen by player) and face-up cards (shared by multiple players)
// outcome: whether hand wins: when specified, true indicating hand won and false indicating a loss, bets could then be settled
case class Hand(
  hand: Seq[Card] = Nil, 
  bets: Map[String, Int] = Map(), 
  owners: Seq[String] = Nil, 
  outcome: Option[Enumeration#Value] = None)

object Hand {
  val empty: Hand = Hand(Nil) // helps with readability (e.g. dealerHand = Hand.empty)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy