Documentation ¶
Index ¶
- Constants
- func MaskByCount(c int) uint
- type Generator
- func (g *Generator) CompactFromString(str string) (Instances, error)
- func (g *Generator) Instance(t tile.Tile) tile.Instance
- func (g *Generator) InstancesFromString(str string) (tile.Instances, error)
- func (g *Generator) Tiles(tiles tile.Tiles) tile.Instances
- func (g *Generator) TilesLeft() tile.Instances
- type Instances
- func (is Instances) Add(t tile.Instances) Instances
- func (is Instances) AddCount(t tile.Tile, x int) Instances
- func (is Instances) Check(t tile.Instance) bool
- func (is Instances) Clone() Instances
- func (is Instances) Contains(x Instances) bool
- func (is Instances) CopyFree(in Tiles) Instances
- func (is Instances) CopyFrom(x Instances)
- func (is Instances) CountBits() int
- func (is Instances) CountFree(in Tiles) int
- func (is Instances) Each(f func(mask Mask) bool) bool
- func (is Instances) GetCount(t tile.Tile) int
- func (is Instances) GetFree() Tiles
- func (is Instances) GetFull() Tiles
- func (is Instances) GetMask(t tile.Tile) Mask
- func (is Instances) Instances() tile.Instances
- func (is Instances) Invert() Instances
- func (is Instances) IsEmpty() bool
- func (is Instances) Merge(other Instances) Instances
- func (is Instances) Remove(t tile.Instance) bool
- func (is Instances) Set(t tile.Instance)
- func (is Instances) SetCount(t tile.Tile, x int)
- func (is Instances) SetMask(mask Mask)
- func (is Instances) Sub(other Instances) Instances
- func (is Instances) UniqueTiles() Tiles
- type Mask
- func (m Mask) Check(index tile.CopyID) bool
- func (m Mask) Count() int
- func (m Mask) Each(f func(tile.Instance) bool) bool
- func (m Mask) First() tile.Instance
- func (m Mask) FirstCopy() tile.CopyID
- func (m Mask) FirstCopyNative() tile.CopyID
- func (m Mask) Instances() tile.Instances
- func (m Mask) InvertTiles() Mask
- func (m Mask) IsEmpty() bool
- func (m Mask) IsFull() bool
- func (m Mask) Mask() uint
- func (m Mask) Merge(x Mask) Mask
- func (m Mask) NaiveCount() int
- func (m Mask) Remove(x Mask) Mask
- func (m Mask) SetCopyBit(cid tile.CopyID) Mask
- func (m Mask) SetCount(in int) Mask
- func (m Mask) SetIntBit(index uint) Mask
- func (m Mask) Tile() tile.Tile
- func (m Mask) UnsetCopyBit(cid tile.CopyID) Mask
- func (m Mask) UnsetIntBit(index uint) Mask
- type PackedMasks
- type TestGenerator
- type Tiles
- func (ts Tiles) Check(t tile.Tile) bool
- func (ts Tiles) Count() int
- func (ts Tiles) Each(f func(tile.Tile) bool) bool
- func (ts Tiles) EachRange(begin, end tile.Tile, f func(tile.Tile) bool) bool
- func (ts Tiles) Invert() Tiles
- func (ts Tiles) IsEmpty() bool
- func (ts Tiles) Merge(other Tiles) Tiles
- func (ts Tiles) Normalize() Tiles
- func (ts Tiles) Set(t tile.Tile) Tiles
- func (ts Tiles) SetAll(t tile.Tiles) Tiles
- func (ts Tiles) Sub(other Tiles) Tiles
- func (ts Tiles) Tiles() tile.Tiles
- func (ts Tiles) Unset(t tile.Tile) Tiles
- type Totals
- func (ts Totals) Add(t tile.Tile, d int)
- func (ts Totals) Clone() Totals
- func (ts Totals) Count() int
- func (ts Totals) FreeTiles() Tiles
- func (ts Totals) FullTiles() Tiles
- func (ts Totals) Get(t tile.Tile) int
- func (ts Totals) IsFull(t tile.Tile) bool
- func (ts Totals) Merge(in Instances) Totals
- func (ts Totals) Set(t tile.Tile, d int)
- func (ts Totals) UniqueCount() int
- func (ts Totals) UniqueTiles() Tiles
Constants ¶
View Source
const ( Terminal = Sou1 | Sou9 | Man1 | Man9 | Pin1 | Pin9 Wind = East | South | West | North Dragon = White | Green | Red Man = Man1 | Man2 | Man3 | Man4 | Man5 | Man6 | Man7 | Man8 | Man9 Pin = Pin1 | Pin2 | Pin3 | Pin4 | Pin5 | Pin6 | Pin7 | Pin8 | Pin9 Sou = Sou1 | Sou2 | Sou3 | Sou4 | Sou5 | Sou6 | Sou7 | Sou8 | Sou9 Sequence = Man | Pin | Sou Honor = Wind | Dragon TerminalOrHonor = Terminal | Honor AllTiles = TileEnd - 1 Middle = (AllTiles ^ TerminalOrHonor) & AllTiles GreenYakuman = Sou2 | Sou3 | Sou4 | Sou6 | Sou8 | Green )
View Source
const (
FullMask = 15
)
Variables ¶
This section is empty.
Functions ¶
func MaskByCount ¶
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewTileGenerator ¶
func NewTileGenerator() *Generator
func (*Generator) CompactFromString ¶
func (*Generator) InstancesFromString ¶
type Instances ¶
type Instances []PackedMasks
Not more than 4 tiles per type by implementation
func AllInstances ¶
func AllInstances() Instances
func AllInstancesFromTo ¶
func NewInstances ¶
func NewInstances() Instances
func (Instances) UniqueTiles ¶
type Mask ¶
type Mask uint
func (Mask) FirstCopyNative ¶
func (Mask) InvertTiles ¶
func (Mask) NaiveCount ¶
func (Mask) UnsetIntBit ¶
type PackedMasks ¶
type PackedMasks uint64
func SinglePackedMasks ¶
func SinglePackedMasks(mask Mask, index uint) PackedMasks
func (PackedMasks) CountBits ¶
func (pm PackedMasks) CountBits() int
func (PackedMasks) Set ¶
func (pm PackedMasks) Set(mask Mask, index uint) PackedMasks
type TestGenerator ¶
type TestGenerator struct {
// contains filtered or unexported fields
}
func NewTestGenerator ¶
func NewTestGenerator(t require.TestingT) *TestGenerator
func (*TestGenerator) CompactFromString ¶
func (tg *TestGenerator) CompactFromString(str string) Instances
func (*TestGenerator) InstancesFromString ¶
func (tg *TestGenerator) InstancesFromString(str string) tile.Instances
func (*TestGenerator) TilesLeft ¶
func (tg *TestGenerator) TilesLeft() tile.Instances
Click to show internal directories.
Click to hide internal directories.