Exemple #1
0
 /// <summary>
 /// 悔棋
 /// </summary>
 private void RegretMovePiece()
 {
     try
     {
         changeWaitingState(WaitingState.WaitingRegretPieceCompleted);
         reversiGame.SetRegretPieceArgs(RegretPiece_Finished);
         reversiGame.RegretPieceMove(true);
         UpdateWindow();
         ShowNextEnabledPieces();
         lastMovedPiece.IsLastPiece = false;
         lastMovedPiece             = pieceControls[reversiGame.LastPosition.X, reversiGame.LastPosition.Y];
         lastMovedPiece.IsLastPiece = true;
     }
     catch
     {
         UpdateWindow();
     }
 }
Exemple #2
0
 /// <summary>
 /// 悔棋
 /// </summary>
 protected void RegretMovePiece()
 {
     try
     {
         pieces[reversiGame.LastPosition.X, reversiGame.LastPosition.Y].IsLastPiece = false;
         reversiGame.SetRegretPieceArgs(RegretPiece_Finished);
         bool haveHuman = false, haveAI = false, regretToOwn;
         for (int i = 0; i < 2; i++)
         {
             if (Players[i].myType == PlayerTypes.Human)
             {
                 haveHuman = true;
             }
             else
             {
                 haveAI = true;
             }
         }
         if (haveHuman && haveAI)
         {
             regretToOwn = true;
         }
         else
         {
             regretToOwn = false;
         }
         reversiGame.RegretPieceMove(regretToOwn);
     }
     finally
     {
         for (int i = 0; i < ReversiGame.BoardSize; i++)
         {
             for (int j = 0; j < ReversiGame.BoardSize; j++)
             {
                 pieces[i, j].PieceState = (PieceState)(reversiGame.CurrentBoard[i, j]);
             }
         }
     }
     if (reversiGame.BlackPieceNumber + reversiGame.WhitePieceNumber != 4)
     {
         pieces[reversiGame.LastPosition.X, reversiGame.LastPosition.Y].IsLastPiece = true;
     }
 }