Belot.Deal.RoundPoints C# (CSharp) Метод

RoundPoints() приватный Метод

private RoundPoints ( int points ) : int
points int
Результат int
        private int RoundPoints( int points )
        {
            double ret = points / 10D;
            int halfPoints = (_eastWestPoints + _northSouthPoints) /2;
            int lastDigit = points%10;

            switch( _currentAnnouncement.Type )
            {
                case AnnouncementTypeEnum.NoTrumps:
                    ret = Math.Round( ret );
                    break;
                case AnnouncementTypeEnum.AllTrumps:
                    // round on 4 for the less points
                    ret = Math.Round( ret );
                    if( (lastDigit == 4) && ( points < halfPoints ) )
                        ret++;
                    break;
                case AnnouncementTypeEnum.Spades:
                case AnnouncementTypeEnum.Hearts:
                case AnnouncementTypeEnum.Diamonds:
                case AnnouncementTypeEnum.Clubs:
                    // round on 6 for the less points
                    ret = Math.Floor( ret );
                    if( lastDigit > 6)
                        ret++;
                    else if( (lastDigit == 6)  && ( points < halfPoints ) )
                        ret++;
                    break;
            }

            return (int)ret;
        }