Documentation ¶
Overview ¶
Package ants provides a stylized model of ants foraging and scouting, using trail pheromones.
Index ¶
- func Run()
- type ActForage
- type ActInNest
- type ActReturn
- type ActScout
- type Ant
- type AntEdge
- type Colors
- type Edge
- type EdgeGeometry
- type Nest
- type Node
- type NodeResource
- type Patches
- func (p *Patches) CellCenter(x, y int) (float64, float64)
- func (p *Patches) Contains(x, y int) bool
- func (p *Patches) Get(x, y int) ecs.Entity
- func (p *Patches) Set(x, y int, node ecs.Entity)
- func (p *Patches) ToCell(x, y float64) (int, int)
- func (p *Patches) ToCellCenter(x, y float64) (float64, float64)
- type Position
- type SysForaging
- type SysInitGrid
- type SysInitNest
- type SysMoveAnts
- type SysNestDecisions
- type SysResources
- type SysReturning
- type SysScouting
- type SysTraceDecay
- type Trace
- type UISysClearFrame
- type UISysDrawAnts
- type UISysDrawGrid
- type UISysDrawNest
- type UISysDrawResources
- type UISysManagePause
- type UISysRepaint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AntEdge ¶
AntEdge component
type EdgeGeometry ¶
EdgeGeometry component
type Patches ¶
Patches resource holding a grid of potential flower patches.
func NewPatches ¶
NewPatches creates a new Patches resource from world dimensions and grid cell size.
func (*Patches) CellCenter ¶
CellCenter returns the world coordinates of the center of the given cell.
type SysForaging ¶
type SysForaging struct { MaxCollect float64 ProbExponent float64 RandomProb float64 TraceDecay float64 MaxSearchTime int ScoutProbability float64 // contains filtered or unexported fields }
SysForaging is a system that performs forager decisions.
func (*SysForaging) Initialize ¶
func (s *SysForaging) Initialize(world *ecs.World)
Initialize the system
type SysInitGrid ¶
type SysInitGrid struct{}
SysInitGrid is a system to create a network on a grid.
func (*SysInitGrid) Initialize ¶
func (s *SysInitGrid) Initialize(world *ecs.World)
Initialize the system
type SysInitNest ¶
type SysInitNest struct { AntsPerNest int // contains filtered or unexported fields }
SysInitNest is a system to initialize an ant nest, and to populate it with ants.
func (*SysInitNest) Initialize ¶
func (s *SysInitNest) Initialize(world *ecs.World)
Initialize the system
type SysMoveAnts ¶
type SysMoveAnts struct { MaxSpeed float64 // contains filtered or unexported fields }
SysMoveAnts is a system that moves ants along their edges.
func (*SysMoveAnts) Initialize ¶
func (s *SysMoveAnts) Initialize(world *ecs.World)
Initialize the system
type SysNestDecisions ¶
type SysNestDecisions struct { ReleaseInterval int64 ReleaseCount int ScoutProbability float64 ProbExponent float64 // contains filtered or unexported fields }
SysNestDecisions is a system that performs ant decisions in the nest.
Particularly, it decides whether bees go for scouting or foraging.
func (*SysNestDecisions) Finalize ¶
func (s *SysNestDecisions) Finalize(world *ecs.World)
Finalize the system
func (*SysNestDecisions) Initialize ¶
func (s *SysNestDecisions) Initialize(world *ecs.World)
Initialize the system
func (*SysNestDecisions) Update ¶
func (s *SysNestDecisions) Update(world *ecs.World)
Update the system
type SysResources ¶
type SysResources struct { Count int // contains filtered or unexported fields }
SysResources is a system that initializes and manages collectible resources.
func (*SysResources) Finalize ¶
func (s *SysResources) Finalize(world *ecs.World)
Finalize the system
func (*SysResources) Initialize ¶
func (s *SysResources) Initialize(world *ecs.World)
Initialize the system
type SysReturning ¶
type SysReturning struct { ProbExponent float64 RandomProb float64 TraceDecay float64 // contains filtered or unexported fields }
SysReturning is a system that performs decisions of ants going back to their nest.
func (*SysReturning) Finalize ¶
func (s *SysReturning) Finalize(world *ecs.World)
Finalize the system
func (*SysReturning) Initialize ¶
func (s *SysReturning) Initialize(world *ecs.World)
Initialize the system
type SysScouting ¶
type SysScouting struct { MaxCollect float64 TraceDecay float64 MaxSearchTime int // contains filtered or unexported fields }
SysScouting is a system that performs scout decisions.
func (*SysScouting) Initialize ¶
func (s *SysScouting) Initialize(world *ecs.World)
Initialize the system
type SysTraceDecay ¶
type SysTraceDecay struct { Persistence float64 // contains filtered or unexported fields }
SysTraceDecay is a system that decays ant traces.
func (*SysTraceDecay) Finalize ¶
func (s *SysTraceDecay) Finalize(world *ecs.World)
Finalize the system
func (*SysTraceDecay) Initialize ¶
func (s *SysTraceDecay) Initialize(world *ecs.World)
Initialize the system
type UISysClearFrame ¶
type UISysClearFrame struct {
// contains filtered or unexported fields
}
UISysClearFrame is a simple system that clears the [Image] resource before other systems draw on it.
func (*UISysClearFrame) FinalizeUI ¶
func (s *UISysClearFrame) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysClearFrame) InitializeUI ¶
func (s *UISysClearFrame) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysClearFrame) PostUpdateUI ¶
func (s *UISysClearFrame) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysClearFrame) UpdateUI ¶
func (s *UISysClearFrame) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawAnts ¶
type UISysDrawAnts struct {
// contains filtered or unexported fields
}
UISysDrawAnts is a system that draws ants.
func (*UISysDrawAnts) FinalizeUI ¶
func (s *UISysDrawAnts) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawAnts) InitializeUI ¶
func (s *UISysDrawAnts) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawAnts) PostUpdateUI ¶
func (s *UISysDrawAnts) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawAnts) UpdateUI ¶
func (s *UISysDrawAnts) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawGrid ¶
type UISysDrawGrid struct {
// contains filtered or unexported fields
}
UISysDrawGrid is a system that draws grid nodes.
func (*UISysDrawGrid) FinalizeUI ¶
func (s *UISysDrawGrid) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawGrid) InitializeUI ¶
func (s *UISysDrawGrid) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawGrid) PostUpdateUI ¶
func (s *UISysDrawGrid) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawGrid) UpdateUI ¶
func (s *UISysDrawGrid) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawNest ¶
type UISysDrawNest struct {
// contains filtered or unexported fields
}
UISysDrawNest is a system that draws the ant nest.
func (*UISysDrawNest) FinalizeUI ¶
func (s *UISysDrawNest) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawNest) InitializeUI ¶
func (s *UISysDrawNest) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawNest) PostUpdateUI ¶
func (s *UISysDrawNest) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawNest) UpdateUI ¶
func (s *UISysDrawNest) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawResources ¶
type UISysDrawResources struct {
// contains filtered or unexported fields
}
UISysDrawResources is a system that draws resource patches.
func (*UISysDrawResources) FinalizeUI ¶
func (s *UISysDrawResources) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawResources) InitializeUI ¶
func (s *UISysDrawResources) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawResources) PostUpdateUI ¶
func (s *UISysDrawResources) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawResources) UpdateUI ¶
func (s *UISysDrawResources) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysManagePause ¶
type UISysManagePause struct {
// contains filtered or unexported fields
}
UISysManagePause is a simple system that listens to clicks and pauses the simulation..
func (*UISysManagePause) FinalizeUI ¶
func (s *UISysManagePause) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysManagePause) InitializeUI ¶
func (s *UISysManagePause) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysManagePause) PostUpdateUI ¶
func (s *UISysManagePause) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysManagePause) UpdateUI ¶
func (s *UISysManagePause) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysRepaint ¶
type UISysRepaint struct {
// contains filtered or unexported fields
}
UISysRepaint is a simple system that paints an [Image] resource to a common.Canvas.
func (*UISysRepaint) FinalizeUI ¶
func (s *UISysRepaint) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysRepaint) InitializeUI ¶
func (s *UISysRepaint) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysRepaint) PostUpdateUI ¶
func (s *UISysRepaint) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysRepaint) UpdateUI ¶
func (s *UISysRepaint) UpdateUI(world *ecs.World)
UpdateUI the system
Source Files ¶
- components.go
- doc.go
- resources.go
- run.go
- sys_clear_frame.go
- sys_decay.go
- sys_draw_ants.go
- sys_draw_grid.go
- sys_draw_nest.go
- sys_draw_resources.go
- sys_foraging.go
- sys_init_grid.go
- sys_init_nest.go
- sys_move_ants.go
- sys_nest_decisions.go
- sys_pause.go
- sys_repaint.go
- sys_resources.go
- sys_returning.go
- sys_scouting.go