Ejemplo n.º 1
0
        private void cmdStart_Click(object sender, EventArgs e)
        {
            result = 0;
            int firstPlayer;

            if (optHuman.Checked == true)
            {
                firstPlayer = 0;
            }
            else
            {
                firstPlayer = 1;
            }
            game = new TicTacToe(this, 3, firstPlayer);
            new System.Threading.Thread(new System.Threading.ThreadStart(game.Play)).Start();
            timer1.Enabled   = true;
            cmdStart.Enabled = false;
        }
Ejemplo n.º 2
0
        public ComputerPlayer(TicTacToe ttt, int playerNo)
        {
            this.playerNo = playerNo;
            String strFileName;

            if (playerNo == 1)
            {
                strFileName = "Brain1.txt";
            }
            else
            {
                strFileName = "Brain2.txt";
            }
            memory = new Trie();
            System.IO.StreamReader filereader = new System.IO.StreamReader(new System.IO.FileStream(strFileName, System.IO.FileMode.OpenOrCreate));
            while (!filereader.EndOfStream)
            {
                memory.add(filereader.ReadLine(), null);
            }
            game = ttt;
            filereader.Close();
        }
Ejemplo n.º 3
0
 public UI(TicTacToe ttt) : base()
 {
     game = ttt;
 }