예제 #1
0
        /// <summary>
        /// 다음 수를 둡니다.
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public static bool PutNext(nPoint position, bool withAIGame)
        {
            if (position == null)
            {
                return(false);
            }
            if (IsAvailablePosition(position) == false)
            {
                return(false);
            }


            if (IsCanNext(position) == true)
            {
                // 바뀌기 이전을 기록한다.
                board.lastPutPosition = position;

                board[position].player = currentTurn;

                Recorder.RecordNext(board);

                ChangeTurn();


                if (IsSameLineExist(board) || Tool.IsFullBoard(board))
                {
                    currentTurn = Players.NULL;
                    SetWL();
                    Recorder.RecordEndGame(winner, loser);

                    if (withAIGame == false)
                    {
                        AI.Learn(Recorder.GetRecord());
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }