lib

package
v0.0.0-...-7909fbe Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PosLess

func PosLess(a, b Pos) bool

Types

type Board

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

func NewBoard

func NewBoard(rows []string, elfAttackPower int) *Board

func (*Board) AddChar

func (b *Board) AddChar(char Char)

func (*Board) Attack

func (b *Board) Attack(er, ee Char) (Char, bool)

func (*Board) Chars

func (b *Board) Chars() []Char

func (*Board) Dump

func (b *Board) Dump()

func (*Board) DumpEdges

func (b *Board) DumpEdges()

func (*Board) DumpWithDecoration

func (b *Board) DumpWithDecoration(decoration Pos, decorationChar rune)

func (*Board) DumpWithDecorations

func (b *Board) DumpWithDecorations(decorations []Pos, decorationChar rune)

func (*Board) MoveChar

func (b *Board) MoveChar(src Char, destPos Pos) Char

func (*Board) OpenSurroundingPositions

func (b *Board) OpenSurroundingPositions(pos Pos) []Pos

surrounding positions that are '.' (I.e. not walls and not characters)

func (*Board) RemoveChar

func (b *Board) RemoveChar(char Char)

func (*Board) ShortestPath

func (b *Board) ShortestPath(from, to Pos) []Pos

func (*Board) SurroundingCharacters

func (b *Board) SurroundingCharacters(pos Pos) []Char

func (*Board) Validate

func (b *Board) Validate() bool

type Char

type Char struct {
	Num   int
	IsElf bool
	P     Pos
	HP    int
	AP    int
}

func NewChar

func NewChar(num int, isElf bool, pos Pos, ap int) *Char

func (Char) Short

func (c Char) Short() rune

func (Char) String

func (c Char) String() string

type CharByReadingOrder

type CharByReadingOrder []Char

func (CharByReadingOrder) Len

func (a CharByReadingOrder) Len() int

func (CharByReadingOrder) Less

func (a CharByReadingOrder) Less(i, j int) bool

func (CharByReadingOrder) Swap

func (a CharByReadingOrder) Swap(i, j int)

type Graph

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

func NewGraph

func NewGraph(sz int) *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to graph.NI)

func (*Graph) AllEdges

func (g *Graph) AllEdges() []GraphEdge

func (*Graph) HasEdge

func (g *Graph) HasEdge(from, to graph.NI) bool

func (*Graph) RemoveEdge

func (g *Graph) RemoveEdge(from, to graph.NI)

func (*Graph) ShortestPath

func (g *Graph) ShortestPath(from, to graph.NI, dist func(from, to graph.NI) int) []graph.NI

type GraphEdge

type GraphEdge struct {
	From, To graph.NI
}

type Pos

type Pos struct {
	X, Y int
}

type PosByReadingOrder

type PosByReadingOrder []Pos

func (PosByReadingOrder) Len

func (a PosByReadingOrder) Len() int

func (PosByReadingOrder) Less

func (a PosByReadingOrder) Less(i, j int) bool

func (PosByReadingOrder) Swap

func (a PosByReadingOrder) Swap(i, j int)

Jump to

Keyboard shortcuts

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