Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created September 30, 2013 06:15
Show Gist options
  • Save tleyden/6759924 to your computer and use it in GitHub Desktop.
Save tleyden/6759924 to your computer and use it in GitHub Desktop.
type RandomThinker struct {
ourTeamId int
}
func (r *RandomThinker) Start(ourTeamId int) {
r.ourTeamId = ourTeamId
}
func (r RandomThinker) Think(gameState GameState) (bestMove ValidMove) {
ourTeam := gameState.Teams[r.ourTeamId]
allValidMoves := ourTeam.AllValidMoves()
randomValidMoveIndex := randomIntInRange(0, len(allValidMoves))
bestMove = allValidMoves[randomValidMoveIndex]
return
}
func (r RandomThinker) Stop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment