Created
September 30, 2013 06:15
-
-
Save tleyden/6759924 to your computer and use it in GitHub Desktop.
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
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