Пример #1
0
        public int Move(int position)
        {
            if (CurrentStatus.IsTerminal || CurrentStatus.Board[position] != 0)
            {
                return(-1);
            }
            CurrentStatus = CurrentStatus.Move(position);

            TileState[] lastBoard = (TileState[])CurrentStatus.Board.Clone();

            if (!CurrentStatus.IsTerminal)
            {
                CurrentStatus = (MCGameStatus)BestMove(CurrentStatus.Player == TileState.X, 1000);
            }

            for (int i = 0; i < lastBoard.Length; i++)
            {
                if (lastBoard[i] != CurrentStatus.Board[i])
                {
                    return(i);
                }
            }
            //you suck at progromming
            return(-1);
        }
Пример #2
0
        public MCGameTree(bool humanFirst = true)
        {
            CurrentStatus = new MCGameStatus();

            if (!humanFirst)
            {
                CurrentStatus = (MCGameStatus)BestMove(true, 1000);
            }
        }
Пример #3
0
        public MCGameStatus Move(int move)
        {
            if (moves == null)
            {
                moves = GenerateMoves();
            }
            MCGameStatus status = moves.FirstOrDefault(x => x.Board[move] == Player);

            if (status == null)
            {
                return(this);
            }
            return(status);
        }