public GameForm() { InitializeComponent(); _randomPlayer = new RandomPlayer(); _optimalPlayer = new OptimalPlayer(SquareTypes.O); _neatPlayer = new NeatPlayer(null, SquareTypes.O); _aiSquareType = SquareTypes.O; _humanSquareType = SquareTypes.X; _game = new TicTacToeGame(); // Set the AI to the random player by default. _ai = _randomPlayer; // Experiment classes encapsulate much of the nuts and bolts of setting up a NEAT search. _experiment = new TicTacToeExperiment(); _hyperNeatExperiment = new TicTacToeHyperNeatExperiment(); // Load config XML for the NEAT experiment. XmlDocument xmlConfig = new XmlDocument(); xmlConfig.Load("tictactoe.config.xml"); _experiment.Initialize("TicTacToe", xmlConfig.DocumentElement); // Load config XML for the HyperNEAT experiment. xmlConfig = new XmlDocument(); xmlConfig.Load("hyperneat.config.xml"); _hyperNeatExperiment.Initialize("TicTacToe", xmlConfig.DocumentElement); }
static void Main(string[] args) { // Initialise log4net (log to console). XmlConfigurator.Configure(new FileInfo("log4net.properties")); // Experiment classes encapsulate much of the nuts and bolts of setting up a NEAT search. TicTacToeExperiment experiment = new TicTacToeExperiment(); // Load config XML. XmlDocument xmlConfig = new XmlDocument(); xmlConfig.Load("tictactoe.config.xml"); experiment.Initialize("TicTacToe", xmlConfig.DocumentElement); // Create evolution algorithm and attach update event. _ea = experiment.CreateEvolutionAlgorithm(); _ea.UpdateEvent += new EventHandler(ea_UpdateEvent); // Start algorithm (it will run on a background thread). _ea.StartContinue(); // Hit return to quit. Console.ReadLine(); }