games

package
v0.0.0-...-a7858fa Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Suites           = 4
	Cascades         = 8
	Freecells        = 4
	MaxCascadeLength = 21
)

Variables

This section is empty.

Functions

func IsCascade

func IsCascade(p *cards.Pos) bool

[y >= 0] and [x >= 0] are the cascades

func IsFoundation

func IsFoundation(p *cards.Pos) bool

[y == -1] and [0 <= x < Suites] are foundations

func IsFreeCell

func IsFreeCell(p *cards.Pos) bool

[y == -1] and [Suites <= x < Freecells - 1] are freecells

Types

type FreeCell

type FreeCell struct {
	// contains filtered or unexported fields
}

func FreeCellGame

func FreeCellGame() *FreeCell

func (*FreeCell) Deal

func (f *FreeCell) Deal(number int)

func (*FreeCell) Debug

func (f *FreeCell) Debug()

func (*FreeCell) Down

func (f *FreeCell) Down()

func (*FreeCell) Left

func (f *FreeCell) Left()

func (*FreeCell) Redeal

func (f *FreeCell) Redeal()

func (*FreeCell) Resize

func (f *FreeCell) Resize(w int, h int)

func (*FreeCell) Right

func (f *FreeCell) Right()

func (*FreeCell) Select

func (f *FreeCell) Select()

func (*FreeCell) Undo

func (f *FreeCell) Undo()

func (*FreeCell) Up

func (f *FreeCell) Up()

func (*FreeCell) View

func (f *FreeCell) View() string

type Game

type Game interface {
	Deal(number int)
	Redeal()

	// Navigation
	Up()
	Down()
	Left()
	Right()

	Select()
	Undo()

	View() string

	Resize(w int, h int)

	Debug()
}

Jump to

Keyboard shortcuts

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