-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from MattSScott/server-agent-hashmap
agent array in server changed to hashmap [SERVER]
- Loading branch information
Showing
4 changed files
with
138 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
package baseserver | ||
|
||
import baseagent "github.com/MattSScott/basePlatformSOMAS/pkg/main/BaseAgent" | ||
import ( | ||
baseagent "github.com/MattSScott/basePlatformSOMAS/pkg/main/BaseAgent" | ||
"github.com/google/uuid" | ||
) | ||
|
||
type IAgentOperations[T baseagent.IAgent[T]] interface { | ||
// gives access to the agents in the simulator | ||
GetAgents() 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[T baseagent.IAgent[T]] interface { | ||
// the set of functions defining how a 'game loop' should run | ||
RunGameLoop() | ||
// begins simulator | ||
Start() | ||
// gives access to the agents in the simulator | ||
GetAgents() []T | ||
// gives operations for adding/removing agents from the simulator | ||
IAgentOperations[T] | ||
// gives access to number of iteration in simulator | ||
GetNumTurns() int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters