physics

package
v0.0.0-...-a8a18e3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const HistorySize = 16

Variables

This section is empty.

Functions

func BoolsStr

func BoolsStr(a []bool) string

func Delta6

func Delta6(hist, base []Cube) func(i int) int32

func Extra6

func Extra6(hist, base, cur []Cube) func(i int) int32

func Index6

func Index6(index []int, N int) []int

func SameBools

func SameBools(a, b []bool)

func SetExtra6

func SetExtra6(hist, base, cur []Cube) func(i int, v int32)

func SortByZ

func SortByZ(items []int, get func(i int) int32)

func SortByZCount

func SortByZCount(items []int, get func(i int) int32)

func Value6

func Value6(base []Cube) func(i int) int32

Types

type Cube

type Cube struct {
	Largest     int32
	A, B, C     int32
	X, Y, Z     int32
	Interacting int32
}

func (*Cube) ReadFrom

func (cube *Cube) ReadFrom(r io.Reader) error

Cube utilities

func (*Cube) WriteTo

func (cube *Cube) WriteTo(w io.Writer) error

type Frame

type Frame struct {
	Cubes []Cube
}

func NewFrame

func NewFrame(size int) *Frame

func (*Frame) Assign

func (frame *Frame) Assign(other *Frame)

func (*Frame) Equals

func (a *Frame) Equals(b *Frame) bool

func (*Frame) ReadFrom

func (frame *Frame) ReadFrom(r io.Reader) error

func (*Frame) WriteTo

func (frame *Frame) WriteTo(w io.Writer) error

type State

type State struct {
	History    [HistorySize]*Frame
	FrameIndex int
}

func NewState

func NewState(size int) *State

func (*State) Baseline

func (s *State) Baseline() *Frame

func (*State) Current

func (s *State) Current() *Frame

func (*State) Decode

func (s *State) Decode(snapshot []byte)

func (*State) Encode

func (s *State) Encode() []byte

func (*State) Historic

func (s *State) Historic() *Frame

func (*State) IncFrame

func (s *State) IncFrame()

func (*State) Prev

func (s *State) Prev(i int) *Frame

func (*State) ReadNext

func (s *State) ReadNext(r io.Reader) error

Jump to

Keyboard shortcuts

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