throwlib

package
Version: v0.0.0-...-fb54636 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const API_KEY = "b4chnoWQeR1pBtmDxslcTaReIdThofpR8QiUkiQ6"

public free use key

View Source
const CROSSANGLE_EXPERIMENT = true
View Source
const MAX_EYE_ANGLE = 0.85
View Source
const SELECTION_EFFECT = true
View Source
const SELECTION_METHOD = "closest" // or "highest"

Variables

View Source
var DEBUG = false
View Source
var HyperSet = LayerSet{
	Code: "hyper",

	AnglePref:       radsFromDegs(0.01),
	RingMod:         0,
	AverageDistance: 0.5,
	MathFactor:      4,
	Weights:         [3]int{100, 5, 100},
	ClusterWeight:   150,
}
View Source
var OneEyeSet = LayerSet{
	Code: "educated",

	AnglePref:       radsFromDegs(0.005),
	RingMod:         100,
	AverageDistance: 0.61,
	MathFactor:      440,
	Weights:         [3]int{40, 100, 0},
	ClusterWeight:   180,
}
View Source
var TwoEyeSet = LayerSet{
	Code: "triangulation",

	AnglePref:       radsFromDegs(0.06),
	RingMod:         150,
	AverageDistance: 0.5,
	MathFactor:      38,
	Weights:         [3]int{20, 10, 100},
	ClusterWeight:   180,
}
View Source
var ZeroEyeSet = LayerSet{
	Code: "blind",

	AnglePref:       radsFromDegs(0.08),
	RingMod:         33,
	AverageDistance: 0.22,
	Weights:         [3]int{20, 100, 0},
	ClusterWeight:   150,
}

Functions

func RingID

func RingID(c Chunk) int

Types

type Chunk

type Chunk [2]int
var DEBUG_CHUNK Chunk

func ChunkFromCenter

func ChunkFromCenter(x, y int) Chunk

func ChunkFromPosition

func ChunkFromPosition(x, y float64) Chunk

func ClosestStronghold

func ClosestStronghold(seed int64, t Throw) Chunk

func GenStrongholds

func GenStrongholds(worldSeed int64) (positions []Chunk)

func (Chunk) Angle

func (c Chunk) Angle(a, sx, sy float64) float64

func (Chunk) Center

func (c Chunk) Center() (int, int)

func (Chunk) ChunkDist

func (t Chunk) ChunkDist(other Chunk) float64

func (Chunk) Dist

func (t Chunk) Dist(x, y float64) float64

func (Chunk) Selectable

func (c Chunk) Selectable(fromX, fromY float64) int

func (Chunk) Staircase

func (c Chunk) Staircase() (int, int)

func (Chunk) String

func (c Chunk) String() string

type ChunkList

type ChunkList []Chunk

func ChunksInThrow

func ChunksInThrow(t Throw) ChunkList

type Guess

type Guess struct {
	Chunk      [2]int `json:"chunk"`
	Method     string `json:"method"`
	Confidence int    `json:"confidence"`
	Used       []Throw
}

func (Guess) String

func (g Guess) String() string

type Layer

type Layer func([]Throw, Chunk) int

type LayerSet

type LayerSet struct {
	Code string

	AnglePref       float64
	RingMod         float64
	AverageDistance float64
	MathFactor      float64
	ClusterWeight   float64

	Weights [3]int
}

func (LayerSet) Angle

func (ls LayerSet) Angle(ts []Throw, c Chunk) int

func (LayerSet) CrossAngle

func (ls LayerSet) CrossAngle(ts []Throw, c Chunk) int

func (LayerSet) Layers

func (ls LayerSet) Layers() []Layer

func (LayerSet) Mutate

func (ls LayerSet) Mutate() LayerSet

func (LayerSet) Ring

func (ls LayerSet) Ring(t []Throw, c Chunk) int

func (LayerSet) SumScores

func (ls LayerSet) SumScores(throws []Throw) (map[Chunk]int, int)

type Request

type Request struct {
	Clips   []string `json:"clips"`
	Options struct {
		Hyper bool `json:"hyper"`
	} `json:"options"`
	Session string `json:"session_id"`
}

type Response

type Response struct {
	Chunk  *[2]int `json:"chunk"`
	Coords *[2]int `json:"coords"`
	Player *[2]int `json:"player"`
	Portal *[2]int `json:"portal"`

	Method     string   `json:"method"`
	Confidence int      `json:"confidence"`
	Keep       []string `json:"keep"`
}

func NewResponse

func NewResponse(req Request) Response

func PostRequest

func PostRequest(req Request, offline bool) Response

type ScoredChunk

type ScoredChunk struct {
	Chunk
	Score int
}

func (ScoredChunk) Distance

func (c ScoredChunk) Distance(other interface{}) float64

func (ScoredChunk) GetID

func (c ScoredChunk) GetID() string

type Session

type Session struct {
	Throws      []Throw
	CustomLayer *LayerSet
	LayerSet    LayerSet

	Scores     map[Chunk]int
	TotalScore int

	Options struct {
		Hyper bool
	}
}

func NewSession

func NewSession(cl ...LayerSet) *Session

func (*Session) BestGuess

func (s *Session) BestGuess(ts ...Throw) Guess

func (*Session) ByScore

func (s *Session) ByScore() []Chunk

func (*Session) CalcLayerSet

func (s *Session) CalcLayerSet() LayerSet

func (*Session) Chunks

func (s *Session) Chunks() []Chunk

func (*Session) Layers

func (s *Session) Layers() LayerSet

func (*Session) MakeGuess

func (s *Session) MakeGuess() Guess

type Throw

type Throw struct {
	X, Y, A float64
	Type    ThrowType
}

func NewBlindThrow

func NewBlindThrow(x, y float64) Throw

func NewThrow

func NewThrow(x, y, a float64) Throw

func NewThrowFromArray

func NewThrowFromArray(arr [3]float64) Throw

func NewThrowFromString

func NewThrowFromString(s string) (Throw, error)

/execute in minecraft:overworld run tp @s -214.79 104.61 386.16 76.50 -32.40

func (Throw) RingID

func (t Throw) RingID() int

func (Throw) Similar

func (t Throw) Similar(other Throw) bool

type ThrowType

type ThrowType int
const (
	Overworld ThrowType = iota
	Blind
	Nether
)

func (ThrowType) String

func (t ThrowType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL