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();
         };
     }
 }
예제 #2
0
 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();
         };
     }
 }
예제 #3
0
 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());
         };
     }
 }