Documentation ¶
Overview ¶
Package cribbage provides cribbage scoring.
Cards ¶
To retrieve the cribbage value of a card:
cribbageValue := cribbage.Value(card)
Scoring ¶
To score a play, supply a discard pile:
pegPoints, pegResult := cribbage.Score(cribbage.Peg, discard, Card{})
To score a shown hand, supply a hand and a starter card:
handPoints, handResult := cribbage.Score(cribbage.ShownHand, hand, starter)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ScoreResult ¶
ScoreResult is a score from pegging or showing a hand.
func (ScoreResult) String ¶
func (r ScoreResult) String() string
type ScoreResults ¶
type ScoreResults []ScoreResult
ScoreResults is a slice of scores from pegging or showing a hand.
func Score ¶
func Score(scoringType ScoringType, c joker.Cards, starter joker.Card) (int, ScoreResults)
Score returns the score of a pegging play or shown hand.
func (ScoreResults) Len ¶
func (r ScoreResults) Len() int
func (ScoreResults) Less ¶
func (r ScoreResults) Less(i, j int) bool
func (ScoreResults) Swap ¶
func (r ScoreResults) Swap(i, j int)
type ScoreType ¶
type ScoreType int
ScoreType represents a type of score.
type ScoringType ¶
type ScoringType int
ScoringType represents a set of scoring rules.
const ( Peg ScoringType = 1 ShowHand ScoringType = 2 ShowCrib ScoringType = 3 )
Scoring types
func (ScoringType) String ¶
func (t ScoringType) String() string
Click to show internal directories.
Click to hide internal directories.