Documentation
¶
Index ¶
- Variables
- type Comparable
- type Stack
- func (s Stack[T]) DeepClone() Stack[T]
- func (s Stack[T]) Get(n int32) (T, error)
- func (s Stack[T]) GetRemaining() []T
- func (s Stack[T]) GetRemainingTileCount() int32
- func (s Stack[T]) GetTiles() []T
- func (s Stack[T]) GetTotalTileCount() int32
- func (s *Stack[T]) MoveToTop(tile T) error
- func (s *Stack[T]) Next() (T, error)
- func (s Stack[T]) Peek() (T, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrStackOutOfBounds = errors.New("stack: out of bounds") ErrTileNotFound = errors.New("could not find the given tile") )
Functions ¶
This section is empty.
Types ¶
type Comparable ¶
type Stack ¶
type Stack[T Comparable[T]] struct { // contains filtered or unexported fields }
func New ¶
func New[T Comparable[T]](tiles []T) Stack[T]
New creates new Stack and shuffles it using current time as seed. NODE: Input slice is not copied.
func NewOrdered ¶
func NewOrdered[T Comparable[T]](tiles []T) Stack[T]
NewOrdered creates new Stack and maintains original order. NODE: Input slice is not copied.
func NewSeeded ¶
func NewSeeded[T Comparable[T]](tiles []T, seed int64) Stack[T]
NewSeeded creates new Stack and shuffles it using the provided seed. NODE: Input slice is not copied.
func (Stack[T]) GetRemaining ¶
func (s Stack[T]) GetRemaining() []T
func (Stack[T]) GetRemainingTileCount ¶
func (Stack[T]) GetTiles ¶
func (s Stack[T]) GetTiles() []T
returns the original tiles slice (input to constructor), not a shuffled slice
func (Stack[T]) GetTotalTileCount ¶
Click to show internal directories.
Click to hide internal directories.