~bonbon/gmcts

e8594bbaa1a44867d0b6a1f8f7b4c765d299a705 — bonbon 1 year, 6 months ago 796142c
test terminal status before expanding tree
1 files changed, 4 insertions(+), 2 deletions(-)

M search.go
M search.go => search.go +4 -2
@@ 34,11 34,13 @@ func (n *node) runSimulation() ([]Player, float64) {
	var selectedChildIndex int
	var winners []Player
	var scoreToAdd float64
	if n.actionCount == 0 {

	terminalState := n.state.IsTerminal()
	if !terminalState && n.actionCount == 0 {
		n.expand()
	}

	if n.state.Game.IsTerminal() {
	if terminalState {
		//Get the result of the game
		winners = n.simulate()
		scoreToAdd = 1.0 / float64(len(winners))