Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharacterInputSource ¶
type CharacterInputSource interface {
// Name Get the name of the character input source.
Name() string
// ChooseMove Choose the next move for a character.
//
// There is always at least one legal move: a forfeit. Nothing else is legal, so the
// character must choose to discard one card. In standard mode, there is effectively no
// choice (since there is only one card in play), but in adult mode the character can choose
// which to discard. If a move has an empty list of actions, then this is a forfeit.
//
// The source must return a move from among the passed-in set of legal moves. If a source
// returns an illegal move, then a legal move will be chosen at random and executed. This way,
// a misbehaving source (or a source attempting to cheat) does not get an advantage. The game
// rules require a player to make a legal move if one is available, even if that move is
// disadvantageous.
ChooseMove(mode model.GameMode, view model.PlayerView, legalMoves []model.Move) (model.Move, error)
}
func RandomInputSource ¶
func RandomInputSource() CharacterInputSource
RandomInputSource source of input for a character which chooses randomly from among legal moves.
func RewardInputSource ¶
func RewardInputSource(evaluator rules.Rules, calculator reward.Calculator) CharacterInputSource
RewardInputSource source of input for a character which chooses its next move based on a reward calculation.
type MockCharacterInputSource ¶
MockCharacterInputSource is an autogenerated mock type for the CharacterInputSource type
func NewMockCharacterInputSource ¶
func NewMockCharacterInputSource(t interface {
mock.TestingT
Cleanup(func())
}) *MockCharacterInputSource
NewMockCharacterInputSource creates a new instance of MockCharacterInputSource. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockCharacterInputSource) ChooseMove ¶
func (_m *MockCharacterInputSource) ChooseMove(mode model.GameMode, view model.PlayerView, legalMoves []model.Move) (model.Move, error)
ChooseMove provides a mock function with given fields: mode, view, legalMoves
func (*MockCharacterInputSource) Name ¶
func (_m *MockCharacterInputSource) Name() string
Name provides a mock function with given fields: