v0.0.0-...-2080b93 Latest Latest

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

Go to latest
Published: May 9, 2021 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Agent

type Agent struct {
	ID         string
	X          int
	Y          int
	Health     int
	Vision     int
	Metabolism int
	Age        int

func NewAgent

func NewAgent() Agent

func (*Agent) ConsumeFood

func (a *Agent) ConsumeFood(amount int)

func (*Agent) Metabolize

func (a *Agent) Metabolize()

func (Agent) ToString

func (a Agent) ToString() string

type Cell

type Cell struct {
	Sugar    int
	Capacity int

	Occupant *Agent

func NewCell

func NewCell(capacity int) Cell

type SugarscapeGame

type SugarscapeGame struct {

	BoardWidth  int
	BoardHeight int
	Cycle       int
	Running     bool

	Board  [][]Cell
	Agents map[string]*Agent
var Sugarscape *SugarscapeGame

func NewSugarscape

func NewSugarscape(worldWidth, worldHeight int) *SugarscapeGame

func (*SugarscapeGame) AgentAge

func (s *SugarscapeGame) AgentAge(agent *Agent)

func (*SugarscapeGame) AgentConsume

func (s *SugarscapeGame) AgentConsume(agent *Agent)

func (*SugarscapeGame) AgentPlacement

func (s *SugarscapeGame) AgentPlacement(number int)

func (*SugarscapeGame) MoveAgent

func (s *SugarscapeGame) MoveAgent(agent *Agent)

func (*SugarscapeGame) MoveAgentTo

func (s *SugarscapeGame) MoveAgentTo(agent *Agent, x, y int) bool

func (*SugarscapeGame) RemoveAgent

func (s *SugarscapeGame) RemoveAgent(agent *Agent)

func (*SugarscapeGame) ReplenishSugar

func (s *SugarscapeGame) ReplenishSugar()

func (*SugarscapeGame) Reset

func (s *SugarscapeGame) Reset()

func (*SugarscapeGame) Start

func (s *SugarscapeGame) Start()

func (*SugarscapeGame) Stop

func (s *SugarscapeGame) Stop()

func (*SugarscapeGame) SugarPlacements

func (s *SugarscapeGame) SugarPlacements()

func (*SugarscapeGame) Update

func (s *SugarscapeGame) Update() error

Jump to

Keyboard shortcuts

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