Ejemplo n.º 1
0
        override public void CalculateCost()
        {


            // update the network with the new gene values
            this.UpdateNetwork();

            PlayerNeural player1 = new PlayerNeural(this.Network);
            Player player2;

            player2 = (Player)Assembly.GetExecutingAssembly().CreateInstance(this.getTicTacToeGenetic().getOpponent().FullName);

            ScorePlayer score = new ScorePlayer(player1, player2, false);

            double cost = score.score();
            // sometimes the score will be zero, just due to "luck"
            // if this is the case, try once more
            if (cost < 0.00001)
            {
                cost = score.score();
            }

            this.Cost = cost;
        }
        public void playNeural()
        {
            FeedforwardNetwork network = loadNetwork();

            Player[] players = new Player[2];
            players[0] = new PlayerNeural(network);
            players[1] = new PlayerMinMax();
            ScorePlayer score = new ScorePlayer(players[0], players[1], true);
            score.score();

        }
 public void playMatch()
 {
     Player[] players = new Player[2];
     players[0] = this.player1;
     players[1] = this.player2;
     ScorePlayer score = new ScorePlayer(players[0], players[1], true);
     Console.WriteLine("Score:" + score.score());
 }