func Sum(c joker.Cards) int
Sum returns the total cribbage value of the supplied cards.
func Value(c joker.Card) int
Value returns the cribbage value of a card.
ScoreResult is a score from pegging or showing a hand.
type ScoreResult struct {
Type ScoreType
Cards joker.Cards
Points int
}
func (r ScoreResult) String() string
ScoreResults is a slice of scores from pegging or showing a hand.
type ScoreResults []ScoreResult
func Score(scoringType ScoringType, c joker.Cards, starter joker.Card) (int, ScoreResults)
Score returns the score of a pegging play or shown hand.
func (r ScoreResults) Len() int
func (r ScoreResults) Less(i, j int) bool
func (r ScoreResults) Swap(i, j int)
ScoreType represents a type of score.
type ScoreType int
Score types and their point values
const (
Score15 ScoreType = 1 // 2
ScorePair ScoreType = 2 // 2
ScoreRun ScoreType = 3 // 1/card
ScoreFlush ScoreType = 4 // 1/card
ScoreNibs ScoreType = 5 // 2
ScoreNobs ScoreType = 6 // 1
Score31 ScoreType = 7 // 2
ScoreGo ScoreType = 8 // 1
)
func (t ScoreType) String() string
ScoringType represents a set of scoring rules.
type ScoringType int
Scoring types
const (
Peg ScoringType = 1
ShowHand ScoringType = 2
ShowCrib ScoringType = 3
)
func (t ScoringType) String() string