private void computerPlay() { if (!game.Finished()) { if ( (game.CurrentPlayer == Player.Cross) && (computerXSwitch.On) // computer plays X || (game.CurrentPlayer == Player.Nought) && (computerOSwitch.On) // computer plays O ) { BasePlayer player = new SimplePlayer(); // RandomPlayer(); player.PlayBestMove(game); gameToView(); } ; } }
private void computerPlay() { if (!game.Finished()) { if ( (game.CurrentPlayer == Player.Cross) && (ComputerXCheckBox.Checked) // computer plays X || (game.CurrentPlayer == Player.Nought) && (ComputerOCheckBox.Checked) // computer plays O ) { BasePlayer player = new SimplePlayer(); // RandomPlayer(); player.PlayBestMove(game); gameToView(); showWinner(game.Winner()); } ; } }
private void computerPlay() { if (game.Finished()) { showWinner(game.Winner()); // there is no DoEvents in Windows Phone, and no workaround, so do this properly :_ } else { if ( (game.CurrentPlayer == Player.Cross) && (checkBoxIsChecked(computerXCheckBox)) // computer plays X || (game.CurrentPlayer == Player.Nought) && (checkBoxIsChecked(computerOCheckBox)) // computer plays O ) { BasePlayer player = new SimplePlayer(); // RandomPlayer(); player.PlayBestMove(game); gameToView(); } ; } }