示例#1
0
        public IEnumerable <int> MovesFrom(IPosition state, int from)
        {
            switch (state.ColumnHeightAt(from))
            {
            case 1:
                return(GetPawnMoves(state, from));

            case 2:
                return(GetRookMoves(state, from));

            case 3:
                return(GetKnightMoves(state, from));

            case 4:
                return(GetBishopMoves(state, from));

            case 5:
                return(GetQueenMoves(state, from));

            default:
                throw new InvalidOperationException(string.Format("Invalid height value: {0}", state.ColumnHeightAt(from)));
            }
        }