2014-04-23 14:28:06 -07:00
|
|
|
package client
|
2014-04-09 21:35:54 -07:00
|
|
|
|
2016-07-13 15:04:48 -07:00
|
|
|
import "hackerbots.us/server"
|
2014-04-09 21:35:54 -07:00
|
|
|
|
2014-04-09 23:11:28 -07:00
|
|
|
// Player is the interface that is implemented when specifying non-default
|
|
|
|
// player behavior.
|
|
|
|
//
|
|
|
|
// The general case will be to implement a Player type that contains the magic
|
|
|
|
// required to slay other robots quickly while staying alive for a long time.
|
2014-04-09 21:35:54 -07:00
|
|
|
type Player interface {
|
|
|
|
|
2016-07-13 15:04:48 -07:00
|
|
|
// GetStats returns a map with an entry for each robot the player will control
|
|
|
|
// containing the desired stats for that robot
|
|
|
|
GetStats() map[string]server.StatsRequest
|
2014-04-09 21:35:54 -07:00
|
|
|
|
2016-07-13 20:25:51 -07:00
|
|
|
// SetIDs is called from the client once the server
|
|
|
|
// has accepted the robots supplied in GetStats and validated
|
|
|
|
// their config, the data passed into SetIDs is a mapping of
|
|
|
|
// bot name to server side bot ID that is used in all bot
|
|
|
|
// dats sent from the server
|
|
|
|
SetIDs(map[string]string)
|
|
|
|
|
2016-07-13 15:04:48 -07:00
|
|
|
// Update is called on reciept of a board state packet and the response is
|
|
|
|
// the instructions for each robot in a map of robot id to instructions
|
|
|
|
Update(bs *server.Boardstate) map[string]server.Instruction
|
2014-04-09 21:35:54 -07:00
|
|
|
}
|
|
|
|
|
2016-07-13 15:04:48 -07:00
|
|
|
type Spectator struct{}
|
2014-04-09 21:35:54 -07:00
|
|
|
|
2016-07-13 20:25:51 -07:00
|
|
|
func (s Spectator) SetIDs(map[string]string) {}
|
|
|
|
|
2016-07-13 15:04:48 -07:00
|
|
|
func (s Spectator) GetStats() map[string]server.StatsRequest {
|
|
|
|
return nil
|
2014-04-09 21:35:54 -07:00
|
|
|
}
|
2015-08-31 21:48:25 -07:00
|
|
|
|
|
|
|
func (s Spectator) Update(bs *server.Boardstate) map[string]server.Instruction {
|
|
|
|
return nil
|
|
|
|
}
|