board

package
v0.0.0-...-b596380 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty  = ' '
	Green  = 'g'
	Yellow = 'y'
	White  = 'w'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Grid

type Grid [][]rune

type Tile

type Tile struct {
	Row    int
	Col    int
	Letter rune
	Color  rune
}

type Waffle

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

Waffle implements a waffle game board

func New

func New(size int) Waffle

New creates an empty waffle game board

func Parse

func Parse(serial string) Waffle

Parse unpacks a string into its corresponding waffle game board

func (*Waffle) AllLetters

func (w *Waffle) AllLetters() map[rune]int

AllLetters returns all the letters and their count

func (*Waffle) Get

func (w *Waffle) Get(row, col int) (rune, rune)

Get returns the letter and color at row, col

func (*Waffle) Letters

func (w *Waffle) Letters(c rune) map[rune]int

Letters returns the letters of a given color and their count

func (*Waffle) Print

func (w *Waffle) Print()

Print prints the waffle game board state to the console

func (*Waffle) Serialize

func (w *Waffle) Serialize() string

Serialize packs a waffle game board into a string

func (*Waffle) Set

func (w *Waffle) Set(row, col int, l, c rune)

Set sets the letter and color at row, col

func (*Waffle) Size

func (w *Waffle) Size() int

Size returns the size of the waffle game

func (*Waffle) Tiles

func (w *Waffle) Tiles() []Tile

Tiles returns a slice containing every tile on the waffle game board

func (*Waffle) TilesInCol

func (w *Waffle) TilesInCol(row, col int, matchColor rune) map[rune]int

TilesInCol returns the set of letters of a given color (and their count) adjacent to the given coord

func (*Waffle) TilesInRow

func (w *Waffle) TilesInRow(row, col int, matchColor rune) map[rune]int

TilesInRow returns the set of letters of a given color (and their count) adjacent to the given coord

Jump to

Keyboard shortcuts

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