コード例 #1
0
ファイル: AIBoard.cs プロジェクト: jaltman1/QuoridorProject
 //Does a deep copy of the board passed to the constructor.
 public AIBoard(AIBoard copy)
 {
     InvalidPawnMoves    = new HashSet <Move>(copy.InvalidPawnMoves, new MoveEqualityComparer());
     WallsPlaced         = new List <string>(copy.WallsPlaced);
     PlayerOneLocation   = copy.PlayerOneLocation;
     PlayerTwoLocation   = copy.PlayerTwoLocation;
     PlayerOneNumWalls   = copy.PlayerOneNumWalls;
     PlayerTwoNumWalls   = copy.PlayerTwoNumWalls;;
     IsPlayerOneTurn     = copy.IsPlayerOneTurn;
     ValidWallPlacements = new HashSet <string>(copy.ValidWallPlacements);
 }
コード例 #2
0
ファイル: AIBoard.cs プロジェクト: jaltman1/QuoridorProject
        public List <string> GetWallMoves()
        {
            List <string> possibleMoves = new List <string>();

            if ((IsPlayerOneTurn && PlayerOneNumWalls == 0) || (!IsPlayerOneTurn && PlayerTwoNumWalls == 0))
            {
            }
            else
            {
                foreach (string wall in ValidWallPlacements)
                {
                    //This checks to make sure walls are valid
                    AIBoard tempBoard = new AIBoard(this);
                    tempBoard.MakeMove(wall);

                    if (BoardAnalysis.CheckPathExists(tempBoard, true) && BoardAnalysis.CheckPathExists(tempBoard, false))
                    {
                        possibleMoves.Add(wall);
                    }
                }
            }
            return(possibleMoves);
        }