game

package
v0.0.0-...-dbd6e49 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Board

type Board [10][10]Color

A Board represents a tenten game board.

func (*Board) Copy

func (b *Board) Copy(dst *Board)

Copy copies b into dst.

func (*Board) IsEmpty

func (b *Board) IsEmpty(x, y int) bool

func (*Board) Place

func (b *Board) Place(p Piece, x, y int) int

Place places p at location (x,y), updating b as necessary. It returns the point value of the move. If the move is invalid, Place returns 0 and b is not affected.

func (*Board) String

func (b *Board) String() string

type Color

type Color int
const (
	Empty Color = iota
	Red
	Pink
	Orange
	Yellow
	Green
	Teal
	Cyan
	Blue
	Purple
)

type Dot

type Dot struct {
	X, Y int
}

type Game

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

func New

func New(seed int64) *Game

func (Game) Board

func (g Game) Board() *Board

func (Game) NextBag

func (g Game) NextBag() [3]Piece

func (*Game) Place

func (g *Game) Place(p Piece, x, y int) bool

Place places p at location (x,y) on the Board, updating it as necessary. If the move is invalid, Place returns false and the Board is not affected.

func (Game) Score

func (g Game) Score() int

type Piece

type Piece int
const (
	Line1x2 Piece // vertical line, length 2
	Line1x3       // vertical line, length 3
	Line1x4       // vertical line, length 4
	Line1x5       // vertical line, length 5
	Line2x1       // horizontal line, length 2
	Line3x1       // horizontal line, length 3
	Line4x1       // horizontal line, length 4
	Line5x1       // horizontal line, length 5
	Ltr2x2        // small l, missing top right
	Ltl2x2        // small l, missing top left
	Lbr2x2        // small l, missing bottom right
	Lbl2x2        // small l, missing bottom left
	Ltr3x3        // big l, missing top right
	Ltl3x3        // big l, missing top left
	Lbr3x3        // big l, missing bottom right
	Lbl3x3        // big l, missing bottom left
	Sq1x1         // 1x1 square
	Sq2x2         // 2x2 square
	Sq3x3         // 3x3 square

	NumPieces = int(Sq3x3)
)

func (Piece) Color

func (p Piece) Color() Color

func (Piece) Dots

func (p Piece) Dots() []Dot

func (Piece) Height

func (p Piece) Height() int

func (Piece) Width

func (p Piece) Width() int

Jump to

Keyboard shortcuts

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