dht

package
v0.0.0-...-0992052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2017 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	SrcDeckTroops []card.Troop
	SrcHandTroops [2][]card.Troop
	SrcDrawNos    [2]int
	// contains filtered or unexported fields
}

Cache the hand deck troops cache.

func NewCache

func NewCache(deckTroops []card.Troop, handTroops [2][]card.Troop, drawNos [2]int) (c *Cache)

NewCache create cache.

func (*Cache) CopyWithOutHand

func (c *Cache) CopyWithOutHand(outTroop card.Troop, playix int) (copyCache *Cache)

CopyWithOutHand makes a copy with out one troop on the hand.

func (*Cache) OnlyDeckSet

func (c *Cache) OnlyDeckSet() (set map[card.Troop]bool)

OnlyDeckSet returns the deck set with out any hand troos.

func (*Cache) Set

func (c *Cache) Set(playerix int) (set map[card.Troop]bool)

Set returns the deck hand set all troops from both hand and deck.

func (*Cache) SortStrs

func (c *Cache) SortStrs(playix int) (strs [][]card.Troop)

SortStrs the deck hand troops sorted after strenght.

func (*Cache) Sum

func (c *Cache) Sum(playerix, color, no int) (sum int, isOk bool)

Sum returns the highest sum you can make with both deck and hand troops.

func (*Cache) TargetSum

func (c *Cache) TargetSum(playerix, color, no, targetSum int) (res *TargetResult)

TargetSum returns the result of the target sum calculation.

func (*Cache) Troops

func (c *Cache) Troops(playerix, color, no int) (troops []card.Troop, isOk bool)

Troops returns the sorted troops from the hand and deck.

type TargetResult

type TargetResult struct {
	IsPossibel      bool
	IsMade          bool
	ValidDeckTroops []card.Troop
	ValidHandTroops []card.Troop
	NewSum          int
	NewNo           int
}

TargetResult the struct holds the result of a target sum calculation.

func (*TargetResult) Equal

func (t *TargetResult) Equal(o *TargetResult) (isEqual bool)

Equal compares to target results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL