示例#1
0
        public Chessboard(byte width, byte height, Gamemode gamemode)
        {
            this.Width           = width;
            this.Height          = height;
            this.gamemode        = gamemode;
            this.CurrentTeamTurn = TeamColor.White;
            this.CurrentState    = GameState.NotStarted;

            this.Pieces      = new Dictionary <Coordinate, Piece>();
            this.Dangerzone  = new Dictionary <Coordinate, List <Piece> >();
            this.Moves       = new Stack <Move>();
            this.MovedPieces = new HashSet <Piece>();
        }
示例#2
0
        /// <summary>
        /// Makes a copy of <c>board</c>, player references stay the same.
        /// </summary>
        /// <param name="board"></param>
        public Chessboard(Chessboard board)
        {
            this.Height          = board.Height;
            this.Width           = board.Width;
            this.CurrentTeamTurn = board.CurrentTeamTurn;
            this.gamemode        = board.gamemode;
            this.CurrentState    = board.CurrentState;

            this.Pieces      = new Dictionary <Coordinate, Piece>(board.Pieces);
            this.MovedPieces = new HashSet <Piece>(board.MovedPieces);
            this.Moves       = new Stack <Move>(board.Moves);
            // not needed before executing move
            this.Dangerzone = new Dictionary <Coordinate, List <Piece> >();
        }
示例#3
0
        /// <summary>
        /// Instantiate board and simulate <c>move</c>.
        /// </summary>
        /// <param name="board"></param>
        /// <param name="move"></param>
        public Chessboard(Chessboard board, Move move)
        {
            this.Height          = board.Height;
            this.Width           = board.Width;
            this.CurrentTeamTurn = board.CurrentTeamTurn;
            this.gamemode        = board.gamemode;
            this.CurrentState    = board.CurrentState;

            this.Pieces      = new Dictionary <Coordinate, Piece>(board.Pieces);
            this.MovedPieces = new HashSet <Piece>(board.MovedPieces);
            this.Moves       = new Stack <Move>(board.Moves.Reverse());

            // is refreshed in simulatemove
            this.Dangerzone = new Dictionary <Coordinate, List <Piece> >();

            this.SimulateMove(move);
        }