public static void RobberScore(DealScoreExt out_score_ext, PairSwitcher pair, ZoneSwitcher zone, Contract contract, Result result, bool BonusForWholeRobber, Robber rob, int robdealNo, bool useOners, OnersSwitcher oners)
        {
            if (rob.WhereCompleted() != -1 && rob.WhereCompleted() < robdealNo)
            {
                out_score_ext.Clear();
            }
            else if (contract.NoContract)
            {
                out_score_ext.DealWasNotPlayed();
            }
            else if (!pair.IsDefined() || !zone.IsDefined() || !contract.IsDefined() || !result.IsDefined() || (useOners && !oners.IsDefined()))
            {
                out_score_ext.Clear();
            }
            else
            {
                bool inzone = ZoneSwitcher.IsPairInZone(pair.Pair, zone.Zone);
                bool enemy_inzone = ZoneSwitcher.IsPairInZone(pair.Pair == Pairs.EW ? Pairs.NS : Pairs.EW, zone.Zone);
                if (result.Quantity >= 0)
                {
                    // --- Если контракт сыгран ---
                    // Очки за взятки:
                    int score = contract.Quantity * (SmallHelper.WhatTrumpType(contract.Trump) == TrumpType.Minor ? 20 : 30) + (contract.Trump == CardTrump.NT ? 10 : 0);
                    if (contract.Contra)
                        score *= 2;
                    else if (contract.ReContra)
                        score *= 4;
                    // Премия за превышение взяток:
                    ArrayList bonuses = new ArrayList();
                    if (result.Quantity > 0)
                    {
                        if (contract.Contra)
                            bonuses.Add(result.Quantity * (inzone ? 200 : 100));
                        else if (contract.ReContra)
                            bonuses.Add(result.Quantity * (inzone ? 400 : 200));
                        else
                            bonuses.Add(result.Quantity * (SmallHelper.WhatTrumpType(contract.Trump) == TrumpType.Minor ? 20 : 30));
                    }
                    if (contract.Quantity == 6) //малый шлем
                    {
                        bonuses.Add(inzone ? 750 : 500);
                    }
                    else if (contract.Quantity == 7) //большой шлем
                    {
                        bonuses.Add(inzone ? 1500 : 1000);
                    }
                    // Дополнительная премия за оскорбление:
                    if (contract.Contra)
                        bonuses.Add(50);
                    else if (contract.ReContra)
                        bonuses.Add(100);

                    switch (pair.Pair)
                    {
                        case Pairs.EW:
                            out_score_ext.EW_down = score;

                            // Премия за роббер:
                            if (BonusForWholeRobber)
                            {
                                if (rob.WhereCompleted() == robdealNo)
                                    bonuses.Add(enemy_inzone ? 500 : 700);
                            }
                            // Премия за гейм:
                            else
                            {
                                if (rob.WhereCompleted() == robdealNo)
                                    bonuses.Add(500);
                                else if (rob.DoesDealMakeGame(robdealNo))
                                    bonuses.Add(200);
                            }

                            out_score_ext.EW_up = new int[bonuses.Count];
                            for (int i = 0; i < bonuses.Count; i++)
                                out_score_ext.EW_up[i] = (int)bonuses[i];
                            out_score_ext.NS_down = 0;
                            out_score_ext.NS_up = null;
                            break;
                        case Pairs.NS:
                            out_score_ext.NS_down = score;

                            // Премия за роббер:
                            if (BonusForWholeRobber)
                            {
                                if (rob.WhereCompleted() == robdealNo)
                                    bonuses.Add(enemy_inzone ? 500 : 700);
                            }
                            // Премия за гейм:
                            else
                            {
                                if (rob.WhereCompleted() == robdealNo)
                                    bonuses.Add(500);
                                else if (rob.DoesDealMakeGame(robdealNo))
                                    bonuses.Add(200);
                            }

                            out_score_ext.NS_up = new int[bonuses.Count];
                            for (int i = 0; i < bonuses.Count; i++)
                                out_score_ext.NS_up[i] = (int)bonuses[i];
                            out_score_ext.EW_down = 0;
                            out_score_ext.EW_up = null;
                            break;
                    }
                }
                else
                {
                    // --- Если контракт проигран ---
                    int enemy_score = 0;
                    for (int i = -1; i >= result.Quantity; i--)
                    {
                        if (i == -1)
                        {
                            if (contract.Contra)
                                enemy_score += (inzone ? 200 : 100);
                            else if (contract.ReContra)
                                enemy_score += (inzone ? 400 : 200);
                            else
                                enemy_score += (inzone ? 100 : 50);
                        }
                        else
                        {
                            if (contract.Contra)
                                enemy_score += (inzone ? 300 : 200);
                            else if (contract.ReContra)
                                enemy_score += (inzone ? 600 : 400);
                            else
                                enemy_score += (inzone ? 100 : 50);
                        }
                    }
                    switch (pair.Pair)
                    {
                        case Pairs.EW:
                            out_score_ext.EW_down = 0;
                            out_score_ext.EW_up = null;
                            out_score_ext.NS_down = 0;
                            out_score_ext.NS_up = new int[1] { enemy_score };
                            break;
                        case Pairs.NS:
                            out_score_ext.NS_down = 0;
                            out_score_ext.NS_up = null;
                            out_score_ext.EW_down = 0;
                            out_score_ext.EW_up = new int[1] { enemy_score };
                            break;
                    }
                }

                // Премия за онеры !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                if (useOners && oners.Choise != 0)
                {
                    int bonus_for_oners = 0;
                    if (oners.Choise == 1 || oners.Choise == 4) //4o
                        bonus_for_oners = 100;
                    else if (oners.Choise == 2 || oners.Choise == 5) //5o
                        bonus_for_oners = 150;
                    else if (oners.Choise == 3 || oners.Choise == 6) //4A
                        bonus_for_oners = 150;

                    if (oners.Choise >= 1 && oners.Choise <= 3) //премия NS
                    {
                        if (out_score_ext.NS_up == null)
                            out_score_ext.NS_up = new int[] { bonus_for_oners };
                        else
                        {
                            int[] old = out_score_ext.NS_up;
                            out_score_ext.NS_up = new int[old.Count() + 1];
                            for (int i = 0; i < old.Count(); i++)
                                out_score_ext.NS_up[i] = old[i];
                            out_score_ext.NS_up[old.Count()] = bonus_for_oners;
                        }
                    }
                    else if (oners.Choise >= 4 && oners.Choise <= 6) //премия EW
                    {
                        if (out_score_ext.EW_up == null)
                            out_score_ext.EW_up = new int[] { bonus_for_oners };
                        else
                        {
                            int[] old = out_score_ext.EW_up;
                            out_score_ext.EW_up = new int[old.Count() + 1];
                            for (int i = 0; i < old.Count(); i++)
                                out_score_ext.EW_up[i] = old[i];
                            out_score_ext.EW_up[old.Count()] = bonus_for_oners;
                        }
                    }
                }
            }
        }
        public static void SportScore(SimpleScore out_score, PairSwitcher pair, ZoneSwitcher zone, Contract contract, Result result, bool bInvertScore)
        {
            if (out_score == null)
                return;

            if (contract.NoContract)
            {
                out_score.SetScore(0, 0);
            }
            else if (pair == null || zone == null || contract == null || result == null || !pair.IsDefined() || !zone.IsDefined() || !contract.IsDefined() || !result.IsDefined())
            {
                out_score.Born = false;
            }
            else
            {
                bool inzone = ZoneSwitcher.IsPairInZone(pair.Pair, zone.Zone);
                int iNS = 0, iEW = 0;
                if (result.Quantity >= 0)
                {
                    // --- Если контракт сыгран ---
                    // Очки за взятки:
                    int score = contract.Quantity * (SmallHelper.WhatTrumpType(contract.Trump) == TrumpType.Minor ? 20 : 30) + (contract.Trump == CardTrump.NT ? 10 : 0);
                    if (contract.Contra)
                        score *= 2;
                    else if (contract.ReContra)
                        score *= 4;
                    // Премия за превышение взяток:
                    int bonus = 0;
                    if (result.Quantity > 0)
                    {
                        if (contract.Contra)
                            bonus += result.Quantity * (inzone ? 200 : 100);
                        else if (contract.ReContra)
                            bonus += result.Quantity * (inzone ? 400 : 200);
                        else
                            bonus += result.Quantity * (SmallHelper.WhatTrumpType(contract.Trump) == TrumpType.Minor ? 20 : 30);
                    }
                    if (contract.Quantity == 6) //малый шлем
                    {
                        bonus += (inzone ? 750 : 500);
                    }
                    if (contract.Quantity == 7) //большой шлем
                    {
                        bonus += (inzone ? 1500 : 1000);
                    }
                    if (score >= 100) //за гейм
                    {
                        bonus += (inzone ? 500 : 300);
                    }
                    else //за частичную запись
                    {
                        bonus += 50;
                    }
                    // Дополнительная премия:
                    int bonus_plus = 0;
                    if (contract.Contra)
                        bonus_plus = 50;
                    else if (contract.ReContra)
                        bonus_plus = 100;

                    // Присвоение очков:
                    if(pair.Pair == Pairs.NS && !bInvertScore || pair.Pair == Pairs.EW && bInvertScore)
                        iNS = score + bonus + bonus_plus;
                    else if(pair.Pair == Pairs.EW && !bInvertScore || pair.Pair == Pairs.NS && bInvertScore)
                        iEW = score + bonus + bonus_plus;
                }
                else
                {
                    // --- Если контракт проигран ---
                    int enemy_score = 0;
                    for (int i = -1; i >= result.Quantity; i--)
                    {
                        if (i == -1)
                        {
                            if (contract.Contra)
                                enemy_score += (inzone ? 200 : 100);
                            else if (contract.ReContra)
                                enemy_score += (inzone ? 400 : 200);
                            else
                                enemy_score += (inzone ? 100 : 50);
                        }
                        else if (i == -2 || i == -3)
                        {
                            if (contract.Contra)
                                enemy_score += (inzone ? 300 : 200);
                            else if (contract.ReContra)
                                enemy_score += (inzone ? 600 : 400);
                            else
                                enemy_score += (inzone ? 100 : 50);
                        }
                        else
                        {
                            if (contract.Contra)
                                enemy_score += (inzone ? 300 : 300);
                            else if (contract.ReContra)
                                enemy_score += (inzone ? 600 : 600);
                            else
                                enemy_score += (inzone ? 100 : 50);
                        }
                    }

                    // Присвоение очков:
                    if (pair.Pair == Pairs.NS && !bInvertScore || pair.Pair == Pairs.EW && bInvertScore)
                        iEW = enemy_score;
                    else if (pair.Pair == Pairs.EW && !bInvertScore || pair.Pair == Pairs.NS && bInvertScore)
                        iNS = enemy_score;
                }

                // !!! Запись очков в объект данных:
                out_score.SetScore(iNS, iEW);
            }
        }