Exemplo n.º 1
0
        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);
        }