tile

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package tile contains structures that players interact with on game boards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID int

ID is the id of a tile.

type Letter

type Letter rune

Letter is the value of a tile.

func (Letter) MarshalJSON

func (l Letter) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface to marshal letters into strings.

func (*Letter) UnmarshalJSON

func (l *Letter) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the encoding/json.UnMarshaler interface to unmarshal letters from strings.

type Position

type Position struct {
	Tile Tile `json:"t"`
	X    X    `json:"x"`
	Y    Y    `json:"y"`
}

Position represents a tile and its location.

type Tile

type Tile struct {
	ID ID     `json:"id"`
	Ch Letter `json:"ch"`
}

Tile is a piece in the game.

func New

func New(id ID, r rune) (*Tile, error)

New creates a new Tile, throwing an error if the letter is not uppercase in the A-Z range.

type X

type X int

X is the x position of a tile (column).

type Y

type Y int

Y is the y position of a tile (row).

Jump to

Keyboard shortcuts

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