simulation

package
v0.0.0-...-f4b0e07 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2024 Sebastian Kroczek <me@xbug.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	DecreasedSpeed AntSpeed = 3
	DefaultSpeed            = 4
	IncreasedSpeed          = 5
	BoostedSpeed            = 6
)
View Source
const (
	DecreasedRotation AntRotation = 6
	DefaultRotation               = 8
	IncreasedRotation             = 12
	BoostedRotation               = 16
)
View Source
const (
	DecreasedLoad AntLoad = 4
	DefaultLoad           = 5
	IncreasedLoad         = 7
	BoostedLoad           = 10
)
View Source
const (
	DecreasedVision AntVision = 45
	DefaultVision             = 60
	IncreasedVision           = 75
	BoostedVision             = 90
)
View Source
const (
	DecreasedRange AntRange = 0.75
	DefaultRange            = 1.0
	IncreasedRange          = 1.5
	BoostedRange            = 2
)
View Source
const (
	DecreasedEnergy AntEnergy = 50
	DefaultEnergy             = 100
	IncreasedEnergy           = 175
	BoostedEnergy             = 250
)
View Source
const (
	DecreasedAttack AntAttack = 0
	DefaultAttack             = 10
	IncreasedAttack           = 20
	BoostedAttack             = 30
)

Variables

View Source
var MarkCache = markCache{}

Functions

func PutMarking

func PutMarking(m *Marking)

func ToAntRange

func ToAntRange(a ant.Level) float64

Types

type AntAttack

type AntAttack int

AntAttack Adjustments for attack

func ToAntAttack

func ToAntAttack(a ant.Level) AntAttack

type AntEnergy

type AntEnergy int

AntEnergy Adjustments for energy

func ToAntEnergy

func ToAntEnergy(a ant.Level) AntEnergy

type AntHill

type AntHill struct {
	resources.AnimatedSprite

	CurrentSugar int
	// contains filtered or unexported fields
}

func NewAntHill

func NewAntHill(screenWidth, screenHeight int, position orb.Point) *AntHill

func NewRandomAntHill

func NewRandomAntHill(screenWidth, screenHeight, border int) *AntHill

func (*AntHill) Bounds

func (a *AntHill) Bounds() ([2]float64, [2]float64, *AntHill)

func (*AntHill) Draw

func (a *AntHill) Draw(screen *ebiten.Image)

func (*AntHill) Update

func (a *AntHill) Update()

type AntLoad

type AntLoad int

AntLoad Adjustments for load

func ToAntLoad

func ToAntLoad(a ant.Level) AntLoad

type AntOS

type AntOS struct {
	resources.AnimatedSprite

	Target interface{}

	CurrentDirection float64 // in degrees
	State            AntOSState
	CurrentSugarLoad int

	Properties

	SetMarkThreshold int
	SetMarkResetTime int
	// contains filtered or unexported fields
}

func NewAntOS

func NewAntOS(simulation *Simulation, options ...AntOptions) *AntOS

func (*AntOS) Collides

func (a *AntOS) Collides() ([2]float64, [2]float64, SearchIter)

func (*AntOS) Draw

func (a *AntOS) Draw(screen *ebiten.Image)

func (*AntOS) GetCurrentLoad

func (a *AntOS) GetCurrentLoad() int

func (*AntOS) GetDirectionToSugar

func (a *AntOS) GetDirectionToSugar(sugar ant.Sugar) int

func (*AntOS) GetId

func (a *AntOS) GetId() int

func (*AntOS) GetRole

func (a *AntOS) GetRole() string

func (*AntOS) GoForward

func (a *AntOS) GoForward(steps int)

func (*AntOS) GoForwards

func (a *AntOS) GoForwards()

func (*AntOS) GoToSugar

func (a *AntOS) GoToSugar(sugar ant.Sugar)

func (*AntOS) GotToAntHill

func (a *AntOS) GotToAntHill()

func (*AntOS) Init

func (a *AntOS) Init(ant interface{})

func (*AntOS) IsInitialized

func (a *AntOS) IsInitialized() bool

func (*AntOS) See

func (a *AntOS) See() ([2]float64, [2]float64, SearchIter)

func (*AntOS) SetMark

func (a *AntOS) SetMark(radius, information int)

func (*AntOS) Smell

func (a *AntOS) Smell() ([2]float64, [2]float64, SearchIter)

func (*AntOS) TakeSugar

func (a *AntOS) TakeSugar(sugar ant.Sugar) error

func (*AntOS) Turn

func (a *AntOS) Turn(direction int)

func (*AntOS) Update

func (a *AntOS) Update()

type AntOSConstructor

type AntOSConstructor func(AntOptions) *AntOS

type AntOSMoving

type AntOSMoving struct {
	TargetDirection *float64 // The direction the Ant should move to in degrees
	Steps           *int     // The number of steps the Ant should take
}

func (*AntOSMoving) Update

func (a *AntOSMoving) Update(os *AntOS)

type AntOSState

type AntOSState interface {
	Update(os *AntOS)
}

type AntOptions

type AntOptions func(*AntOS)

func WithAntHill

func WithAntHill(antHill *AntHill) AntOptions

func WithPosition

func WithPosition(x, y float64) AntOptions

func WithRole

func WithRole(role string, properties Properties) AntOptions

type AntRange

type AntRange float64

AntRange Adjustments for range

type AntRotation

type AntRotation int

AntRotation Adjustments for rotation

func ToAntRotation

func ToAntRotation(a ant.Level) AntRotation

type AntSpeed

type AntSpeed float64

AntSpeed Adjustments for speed

func ToAntSpeed

func ToAntSpeed(a ant.Level) AntSpeed

type AntVision

type AntVision int

AntVision Adjustments for vision

func ToAntVision

func ToAntVision(a ant.Level) AntVision

type Apple

type Apple struct {
	resources.AnimatedSprite
	// contains filtered or unexported fields
}

func NewApple

func NewApple(screenWidth, screenHeight int, position orb.Point) *Apple

func NewRandomApple

func NewRandomApple(screenWidth, screenHeight, border int) *Apple

func (*Apple) Bounds

func (a *Apple) Bounds() ([2]float64, [2]float64, *Apple)

func (*Apple) Draw

func (a *Apple) Draw(screen *ebiten.Image)

func (*Apple) Update

func (a *Apple) Update()

type Bounds

type Bounds interface {
	ToBox() (min, max [2]float64)
}

type Box

type Box interface {
	ToBox() (min, max [2]float64)
}

type GameObject

type GameObject interface {
	Update()
	Draw(*ebiten.Image)
	GetPosition() orb.Point
}

type Marking

type Marking struct {
	Position    orb.Point
	Radius      int
	Information int
	Lifespan    int
	// contains filtered or unexported fields
}

func GetMarking

func GetMarking() *Marking

func NewMarking

func NewMarking(simulation *Simulation, position orb.Point, radius int, information int) *Marking

func (*Marking) Bounds

func (m *Marking) Bounds() ([2]float64, [2]float64, *Marking)

func (*Marking) Draw

func (m *Marking) Draw(screen *ebiten.Image)

func (*Marking) GetInformation

func (m *Marking) GetInformation() int

func (*Marking) GetPosition

func (m *Marking) GetPosition() orb.Point

func (*Marking) Update

func (m *Marking) Update()

type Properties

type Properties struct {
	Speed    AntSpeed
	Rotation AntRotation
	Load     AntLoad
	Vision   AntVision
	Range    int
	Energy   AntEnergy
	Attack   AntAttack
}

func ApplyAntRole

func ApplyAntRole(defaultRange float64, role ant.Adjustments) Properties

func NewDefaultProperties

func NewDefaultProperties(defaultRange float64) Properties

type RTreeG

type RTreeG[T any] struct {
	// contains filtered or unexported fields
}

func (*RTreeG[T]) Clear

func (r *RTreeG[T]) Clear()

func (*RTreeG[T]) Copy

func (r *RTreeG[T]) Copy() *RTreeG[T]

func (*RTreeG[T]) Delete

func (r *RTreeG[T]) Delete(min, max [2]float64, value T)

func (*RTreeG[T]) Insert

func (r *RTreeG[T]) Insert(min, max [2]float64, value T)

func (*RTreeG[T]) Len

func (r *RTreeG[T]) Len() int

func (*RTreeG[T]) Nearby

func (r *RTreeG[T]) Nearby(
	algo func(min, max [2]float64, data T, item bool) (dist float64),
	iter func(min, max [2]float64, data T, dist float64) bool,
)

func (*RTreeG[T]) Replace

func (r *RTreeG[T]) Replace(
	oldMin, oldMax [2]float64, oldData T,
	newMin, newMax [2]float64, newData T,
)

func (*RTreeG[T]) Scan

func (r *RTreeG[T]) Scan(iter func(min, max [2]float64, data T) bool)

func (*RTreeG[T]) Search

func (r *RTreeG[T]) Search(
	min, max [2]float64,
	iter func(min, max [2]float64, data T) bool,
)

type SearchIter

type SearchIter func(min, max [2]float64, data GameObject) bool

type Simulation

type Simulation struct {
	RolesCount map[string]int
	SimulationConfig
	// contains filtered or unexported fields
}

func NewSimulation

func NewSimulation(screenWidth, screenHeight int, cnf SimulationConfig) *Simulation

func (*Simulation) AddMarking

func (s *Simulation) AddMarking(m *Marking)

func (*Simulation) AddMarkingAtPosition

func (s *Simulation) AddMarkingAtPosition(position orb.Point, radius int, information int)

func (*Simulation) AddNewAnt

func (s *Simulation) AddNewAnt()

func (*Simulation) Draw

func (s *Simulation) Draw(screen *ebiten.Image)

func (*Simulation) FlushMarkingChanges

func (s *Simulation) FlushMarkingChanges()

func (*Simulation) Layout

func (s *Simulation) Layout(_, _ int) (int, int)

func (*Simulation) RemoveAnt

func (s *Simulation) RemoveAnt(ant *AntOS)

func (*Simulation) RemoveMarking

func (s *Simulation) RemoveMarking(m *Marking)

func (*Simulation) RemoveSugar

func (s *Simulation) RemoveSugar(sugar *Sugar)

func (*Simulation) Update

func (s *Simulation) Update() error

type SimulationConfig

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

func NewSimulationConfig

func NewSimulationConfig(options ...SimulationOptions) *SimulationConfig

type SimulationOptions

type SimulationOptions func(*SimulationConfig)

func WithAntConstructor

func WithAntConstructor(antConstructor ant.AntConstructor) SimulationOptions

func WithAntDesiredValue

func WithAntDesiredValue(desiredValue int) SimulationOptions

func WithRoles

func WithRoles(roles map[string]Properties, chooseRole ant.ChooseRole) SimulationOptions

func WithSugarDesiredValue

func WithSugarDesiredValue(desiredValue int) SimulationOptions

type Sugar

type Sugar struct {
	resources.AnimatedSprite
	gmath.Rect
	CurrentSugar int
	// contains filtered or unexported fields
}

func NewRandomSugar

func NewRandomSugar(simulation *Simulation, border int) *Sugar

func NewSugar

func NewSugar(simulation *Simulation, position orb.Point) *Sugar

func (*Sugar) Bounds

func (s *Sugar) Bounds() ([2]float64, [2]float64, *Sugar)

func (*Sugar) Draw

func (s *Sugar) Draw(screen *ebiten.Image)

func (*Sugar) GetCurrentSugar

func (s *Sugar) GetCurrentSugar() int

func (*Sugar) GetLoad

func (s *Sugar) GetLoad(i int) int

func (*Sugar) Update

func (s *Sugar) Update()

Jump to

Keyboard shortcuts

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