Exemple #1
0
/// Play a game to the end.
/// If randomize is true, the first 10 turns are randomized.
func playFullGame(game *g.Game, randomize, show bool, black, white g.Controller) {
	if randomize {
		game.SetControllers(g.NewRandomAI(show), g.NewRandomAI(show))
	}
	for game.PlayTurn() {
		if randomize {
			// stop using the random controller after the first 10 turns
			if game.Score(g.BLACK)+game.Score(g.WHITE) >= 10 {
				game.SetControllers(black, white)
			}
		}
	}
}
Exemple #2
0
func ParseControllers(b, w *string, show *bool) (g.Controller, g.Controller) {
	var bc, wc g.Controller
	switch *b {
	case "shallow":
		bc = g.NewShallowAI(*show)
	case "random":
		bc = g.NewRandomAI(*show)
	case "search":
		bc = g.NewSearchAI(*show)
	default:
		bc = g.NewHumanController()
	}
	switch *w {
	case "shallow":
		wc = g.NewShallowAI(*show)
	case "random":
		wc = g.NewRandomAI(*show)
	case "search":
		wc = g.NewSearchAI(*show)
	default:
		wc = g.NewHumanController()
	}
	return bc, wc
}