Пример #1
0
        public ChessState(ChessState o)
            : this()
        {
            Player = o.Player;
            Castling = o.Castling;

            EnPassant = o.EnPassant;
            HalfMoves = o.HalfMoves;
            FullMoves = o.FullMoves;

            foreach (ChessPiece p in o)
                Board[p.Pos.File - 1, p.Pos.Rank - 1] = new ChessPiece(p);
        }
Пример #2
0
        public override void Apply(IGameState state)
        {
            var s = state as ChessState;

            _Castling = s.Castling;
            switch(state[From].Player.Order)
            {
                case 1:
                    s.Castling.KingsideWhite  = false;
                    s.Castling.QueensideWhite = false;
                    break;
                case 2:
                    s.Castling.KingsideBlack  = false;
                    s.Castling.QueensideBlack = false;
                    break;
            }

            MovePiece(From, To, state);
            MovePiece(RookFrom, RookTo, state);
        }