private void injectPlayer(string file, NN.Generation injectGen)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(Pig.Player));

            Pig.Player aiPlayer = new Pig.Player();


            FileStream openFile = new FileStream("basePlayer.dat", FileMode.Open);

            Pig.Player tempPlayer;
            try
            {
                tempPlayer = (Pig.Player)deserializer.Deserialize(openFile);
            }
            catch (Exception err)
            {
                System.Windows.Forms.MessageBox.Show(err.Message);
                throw;
            }

            openFile.Close();

            aiPlayer             = new Pig.Player(tempPlayer);
            injectGen.Players[0] = aiPlayer;
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 10);


            rndGen         = new Random();
            Pig.RndGen.rnd = rndGen;
            NN.RndGen.rnd  = rndGen;

            aiGeneration = new NN.Generation(20, 40, 2, 1, 1, 1);
        }
        public MainWindow()
        {
            InitializeComponent();

            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 10);


            rndGen         = new Random();
            Pig.RndGen.rnd = rndGen;
            NN.RndGen.rnd  = rndGen;

            //aiGeneration = new NN.Generation(30, 30, 3, 1, 1, 1);
            aiGeneration = new NN.Generation(20, 20, 3, 1, 1, 1);
            //injectPlayer("basePlayer.dat", aiGeneration);
        }