Exemple #1
0
 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();
         }
         ;
     }
 }
Exemple #2
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());
         }
         ;
     }
 }
 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();
         }
         ;
     }
 }