Exemplo n.º 1
0
        private void btnHost_Click(object sender, EventArgs e)
        {
            textBox1.Enabled = false;
            btnJoin.Enabled  = false;
            btnHost.Enabled  = false;
            MessageBox.Show("You are the host of the game. Good Luck!");
            TicTacToe game = new TicTacToe(true);

            Visible = false;
            if (!game.IsDisposed)
            {
                game.ShowDialog();
            }
            if (game.endGame == true)
            {
                Application.Exit();
            }
            Visible = true;
        }
Exemplo n.º 2
0
 //gameloop
 public void GameLoop()
 {
     do
     {
         if (AIvsAI)
         {
             AIwar();
         }
         else
         {
             HUMANvsAI();
         }
         //if (board.ChechWhoWon() != 2) HighlightWin( board.ChechWhoWon() );
         turnCounter = 0;
         ourTurn     = whoStartsBackup;
         board       = new TicTacToe();
         Console.WriteLine("Wciśnij enter, aby rozegrać kolejną partię.");
     } while (Console.ReadKey().Key == ConsoleKey.Enter);
 }
Exemplo n.º 3
0
 private void btnJoin_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         TicTacToe game = new TicTacToe(false, textBox1.Text);
         Visible = false;
         if (!game.IsDisposed)
         {
             game.ShowDialog();
         }
         if (game.endGame == true)
         {
             Application.Exit();
         }
         Visible = true;
     }
     else
     {
         MessageBox.Show("Enter valid IP Address or localhost");
     }
 }
Exemplo n.º 4
0
        static void Main()
        {
            ITicTacToe newGame = new TicTacToe(new Print(), new Board(new Print()), new GameRules());

            newGame.Play();
        }