Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 540 Bytes
package gomcts
import (
"crypto/rand"
"math/big"
)
// RolloutPolicy - function signature determining the next action during Monte Carlo Tree Search rollout
type RolloutPolicy func(GameState) Action
// DefaultRolloutPolicy - default rollout policy, picks action randomly (w.r.t uniform random dist)
func DefaultRolloutPolicy(state GameState) Action {
actions := state.GetLegalActions()
numberOfActions := int64(len(actions))
actionIndex, _ := rand.Int(rand.Reader, big.NewInt(numberOfActions))
return actions[actionIndex.Int64()]
}
You can’t perform that action at this time.