cpu

package
v0.0.0-...-3e8fde6 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Go implementation of Java random Not safe for concurrent use

Index

Constants

View Source
const SectionSize = 128

Variables

This section is empty.

Functions

This section is empty.

Types

type Mask

type Mask struct {
	ORad, IRad int32
}

func (Mask) Bounds

func (m Mask) Bounds() (w, h int32)

func (Mask) Print

func (m Mask) Print()

func (Mask) Query

func (m Mask) Query(x, z int32) bool

type Random

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

func NewRandom

func NewRandom(seed int64) Random

func (*Random) Next

func (r *Random) Next(bits int) int32

func (*Random) NextInt

func (r *Random) NextInt(n int32) int32

func (*Random) SetSeed

func (r *Random) SetSeed(seed int64)

type Searcher

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

func NewSearcher

func NewSearcher(workerCount int, mask Mask) (*Searcher, error)

func (*Searcher) Destroy

func (s *Searcher) Destroy()

func (*Searcher) Search

func (s *Searcher) Search(x0, z0, x1, z1 int32, threshold int, worldSeed int64) []slimy.Result

type Section

type Section struct {
	X, Z  int32
	Slime [SectionSize * SectionSize]bool
}

func (*Section) CheckMask

func (sec *Section) CheckMask(x0, z0 int32, mask Mask) (count uint)

func (*Section) Compute

func (sec *Section) Compute(world World)

func (*Section) Get

func (sec *Section) Get(x, z int32) bool

func (*Section) Print

func (sec *Section) Print()

func (*Section) Search

func (sec *Section) Search(mask Mask, threshold int) (results []slimy.Result)

func (*Section) Set

func (sec *Section) Set(x, z int32, v bool)

type World

type World int64

func (World) CalcChunk

func (w World) CalcChunk(x, z int32) bool

func (World) DrawArea

func (w World) DrawArea(workerCount int, dst draw.Image)

Draws slime chunks on an image. The search area comes from the image's Bounds

Jump to

Keyboard shortcuts

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