예제 #1
0
 /// <summary>
 /// 执行棋局初始化操作 (包括新建棋局实例, 新建人工智能实例. 必要时执行自动下棋操作.)
 /// </summary>
 public void InitializeGame(ReversiPiece userPiece, int AIIndex, WhenGameOver gameOver)
 {
     InitialControls();
     whenGameOver   = gameOver;
     reversiGame    = ReversiGame.CreateANewGame();
     HumanPieceType = userPiece;
     UpdateWindow();
     reversiAI = ReversiAIType.GetAI(AIIndex);
     changeWaitingState(WaitingState.NotWaiting);
     if (HumanPieceType == ReversiPiece.White)
     {
         reversiAI.AIInitialize(ReversiPiece.Black);
         MovePiece();
         DoEvents();
     }
     else
     {
         reversiAI.AIInitialize(ReversiPiece.White);
     }
     ShowNextEnabledPieces();
     isInitialized = true;
     IsUserTurn    = true;
 }
예제 #2
0
파일: AI.cs 프로젝트: walterlv/reversi-game
 public void SetAIType(int type)
 {
     reversiAI = ReversiAIType.GetAI(type) ?? ReversiAIType.GetAI(1);
     reversiAI.AIInitialize(myPieceColor);
 }