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; }
//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); }
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"); } }
static void Main() { ITicTacToe newGame = new TicTacToe(new Print(), new Board(new Print()), new GameRules()); newGame.Play(); }