packed

package
v0.0.0-...-8510552 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package packed provides types and functions for memory efficient representations of robots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRobots

func GetRobots[P Packable](p P, robots []coord.XY)

GetRobots stores the packed representation into the robots slice.

func SetRobot

func SetRobot[P Packable](p P, robot int, b byte) P

SetRobot sets one byte at index robot into p and returns the result.

func SetRobots

func SetRobots[P Packable](robots []byte) P

SetRobots returns a packed representation of robots.

Types

type P4

type P4 [4]byte

P4 is a compressed representation of 4 robots.

func (P4) Hash

func (p P4) Hash(seed maphash.Seed) uint64

Hash returns a hash value of P4.

type P5

type P5 [5]byte

P5 is a compressed representation of 5 robots.

func (P5) Hash

func (p P5) Hash(seed maphash.Seed) uint64

Hash returns a hash value of P5.

type Packable

type Packable interface {
	P4 | P5
	Hash(seed maphash.Seed) uint64
}

Packable interface defines P4 and P5 contraints as packable data types.

Jump to

Keyboard shortcuts

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