baseserver

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentGenerator

type AgentGenerator[T baseagent.IAgent[T]] func() T

type AgentGeneratorCountPair

type AgentGeneratorCountPair[T baseagent.IAgent[T]] struct {
	// contains filtered or unexported fields
}

func MakeAgentGeneratorCountPair

func MakeAgentGeneratorCountPair[T baseagent.IAgent[T]](generatorFunction AgentGenerator[T], count int) AgentGeneratorCountPair[T]

type BaseServer

type BaseServer[T baseagent.IAgent[T]] struct {
	// contains filtered or unexported fields
}

func CreateServer

func CreateServer[T baseagent.IAgent[T]](generatorArray []AgentGeneratorCountPair[T], iterations int) *BaseServer[T]

generate a server instance based on a mapping function and number of iterations

func (*BaseServer[T]) AddAgent

func (bs *BaseServer[T]) AddAgent(agentToAdd T)

func (*BaseServer[T]) GenerateAgentArrayFromMap

func (bs *BaseServer[T]) GenerateAgentArrayFromMap() []T

func (*BaseServer[T]) GetAgentMap

func (bs *BaseServer[T]) GetAgentMap() map[uuid.UUID]T

func (*BaseServer[T]) GetIterations

func (bs *BaseServer[T]) GetIterations() int

func (*BaseServer[T]) RemoveAgent

func (bs *BaseServer[T]) RemoveAgent(agentToAdd T)

func (*BaseServer[T]) RunGameLoop

func (bs *BaseServer[T]) RunGameLoop()

func (*BaseServer[T]) RunMessagingSession

func (bs *BaseServer[T]) RunMessagingSession()

func (*BaseServer[T]) Start

func (bs *BaseServer[T]) Start()

type IAgentOperations

type IAgentOperations[T baseagent.IAgent[T]] interface {
	// gives access to the agents in the simulator
	GetAgentMap() map[uuid.UUID]T
	// adds an agent to the server
	AddAgent(agentToAdd T)
	// removes an agent from the server
	RemoveAgent(agentToRemove T)
	// translate the agent map into an array of agents
	GenerateAgentArrayFromMap() []T
}

type IServer

type IServer[T baseagent.IAgent[T]] interface {
	// gives operations for adding/removing agents from the simulator
	IAgentOperations[T]
	// gives access to number of iteration in simulator
	GetIterations() int
	// the set of functions defining how a 'game loop' should run
	RunGameLoop()
	// starts the agents' messaging session
	RunMessagingSession()
	// begins simulator
	Start()
}

Jump to

Keyboard shortcuts

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