Beispiel #1
0
        public void PairsShouldReturnSumOfPairs(List <int> rolledDice, int expectedOutcome)
        {
            var pairs  = new Pairs();
            var result = pairs.CalculateScore(rolledDice);

            Assert.Equal(expectedOutcome, result);
        }
Beispiel #2
0
        public void Update(double delta, double correction)
        {
            Timestamp += (long)(delta * Timescale);
            var bodies      = World.AllBodies.ToList();
            var constraints = World.AllConstraints.ToList();

            //BodiesApplyGravity(bodies, World.Gravity);
            BodiesUpdate(bodies, delta, Timescale, correction, World.Bounds);
            SolveConstraint(constraints, bodies);
            UpdateBroadphase(bodies, World.Modified);

            if (World.Modified)
            {
                World.SetModified(false, false, true);
            }

            var collisions = FindCollisions(_tmpPairsList);

            Pairs.Update(collisions, Timestamp);
            Pairs.RemoveOld(Timestamp);

            var pairs = Pairs.PairList.Where(pair => pair.Active).ToList();

            SolvePosition(pairs);
            SolveVelocity(pairs);
            BodiesClearForces(bodies);
        }
Beispiel #3
0
        public Pairs GetPairs()
        {
            string _url = $"/v2/public/symbols";

            JToken _token = base.HttpCall(HttpCallMethod.Get, "GET", _url);

            if (_token == null)
            {
                return(null);
            }

            Pairs _pairs = new Pairs();

            foreach (JToken _item in _token.Value <JArray>())
            {
                _pairs[_item["name"].Value <string>()] = new PairItem()
                {
                    Code          = _item["name"].Value <string>(),
                    SymbolFrom    = _item["base_currency"].Value <string>(),
                    SymbolTo      = _item["quote_currency"].Value <string>(),
                    PriceDecimal  = _item["price_decimal"].Value <int>(),
                    AmountDecimal = _item["amount_decimal"].Value <int>()
                };
            }
            return(_pairs);
        }
Beispiel #4
0
        public KopsTournament(string path, IReader readerFactory)
        {
            this.path          = path;
            this.readerFactory = readerFactory;

            TextReader f = readerFactory.GetINFReader(path);

            List <string> file = new List <string>();

            String line;

            while ((line = f.ReadLine()) != null)
            {
                file.Add(line.Split('*')[0]);
            }

            f.Close();

            Pairs = new Pairs();

            SetTournamentData(file);

            //   InitDataSet();

            ReadPlayersNames();
        }
Beispiel #5
0
        private static Pairs boardPairs(int[] BoardRanks)
        {
            // check for board pair
            bool BoardPaired    = false;
            bool BoardTwoPaired = false;
            int  lastPair       = 0;
            int  secondPair     = 0;
            int  t = 0;

            // #@%*(@%(*#*%*@#%(*(*#@(*%(*)%@#(* TWO PAIRED DOESNT WORK UNLESS A A A 2 2, A A 2 2 doesnt #$*(@$*@(#*$(*@#$*(@(*#$(*#@$
            foreach (int i in BoardRanks)
            {
                t++;
                for (int j = t; j < BoardRanks.Length; j++)
                {
                    if (i == BoardRanks[j] && BoardPaired && lastPair != i)
                    {
                        BoardTwoPaired = true; secondPair = i; break;
                    }
                    if (i == BoardRanks[j])
                    {
                        BoardPaired = true; lastPair = i;
                    }
                }
            }

            Pairs pairs = new Pairs();

            pairs.BoardPaired    = BoardPaired;
            pairs.BoardTwoPaired = BoardTwoPaired;
            pairs.FirstPair      = lastPair;
            pairs.SecondPair     = secondPair;
            return(pairs);
        }
        public void ReturnCountOf_SpecifiedValuesInCollection()
        {
            var valuesPassed = new List <List <string> >
            {
                new List <string> {
                    "1", "2", "3"
                },
                new List <string> {
                    "1", "2", "3"
                }
            };
            var itemsToFind = new List <string> {
                "1", "2"
            };
            var expected = new Pairs <string> {
                Item = "1", Item2 = "2", Frequency = 2
            };

            var actual = valuesPassed.CalculatePairs(itemsToFind, false);

            var actualStr   = JsonConvert.SerializeObject(actual);
            var expectedStr = JsonConvert.SerializeObject(expected);

            Assert.Equal(expectedStr, actualStr);
        }
Beispiel #7
0
        public void Init()
        {
            for (int i = 0; i < Template.Length; i++)
            {
                // add in template characters
                char ch = Template[i];
                if (Elems.ContainsKey(ch))
                {
                    Elems[ch]++;
                }
                else
                {
                    Elems.Add(ch, 1);
                }
            }

            // add in pairs
            for (int i = 0; i < Template.Length - 1; i++)
            {
                var key = Template.Substring(i, 2);
                if (Pairs.ContainsKey(key))
                {
                    Pairs[key]++;
                }
                else
                {
                    Pairs.Add(key, 1);
                }
            }
        }
Beispiel #8
0
        public override async Task <AutoHintItems> GetAutoHintItemsAsync(SearchPara para, CancellationToken token)
        {
            var          ahitems = new AutoHintItems();
            const string api     = "https://capi-v2.sankakucomplex.com";

            Net = Net == null ? new NetDocker(Settings, api) : Net.CloneWithOldCookie();
            var pairs = new Pairs
            {
                { "lang", "en" },
                { "tag", para.Keyword.ToEncodedUrl() },
                { "target", "post" },
                { "show_meta", "1" }
            };
            var json = await Net.GetJsonAsync($"{api}/tags/autosuggestCreating", token, pairs);

            foreach (var jitem in Extend.CheckListNull(json))
            {
                var ahitem = new AutoHintItem();
                ahitem.Word  = $"{jitem.name}";
                ahitem.Count = $"{jitem.count}";
                ahitems.Add(ahitem);
            }

            return(ahitems);
        }
Beispiel #9
0
 public Selection(ISelect <TIn, TOut> @default, params Pair <string, Func <TIn, TOut> >[] pairs)
     : this(Start.A.Selection.Of <string>()
            .By.Returning(@default.ToDelegate())
            .Unless(Pairs.Select(pairs))
            .To(NullOrEmpty.Default.Select))
 {
 }
Beispiel #10
0
        public PingConnectionString(string connectionString) : base(connectionString)
        {
            _Host = new Lazy <string>(() =>
            {
                return
                (Pairs.GetFirstString("Address")
                 ?? Pairs.GetFirstWithoutKey()
                 ?? throw new Exception("Address parameter is undefined"));
            });

            _Timeout = new Lazy <int>(() =>
            {
                return(Pairs.GetFirstInt("Timeout", defVal: 2000, min: 1, max: 120000));
            });

            _Ttl = new Lazy <int>(() =>
            {
                return(Pairs.GetFirstInt("Ttl", defVal: 64, min: 1, max: 255));
            });

            _Size = new Lazy <int>(() =>
            {
                return(Pairs.GetFirstInt("Size", defVal: 32, min: 1, max: 128 * 1024));
            });

            _AllowFragment = new Lazy <bool>(() =>
            {
                return(Pairs.GetFirstBool("AllowFragment", defVal: true));
            });
        }
        public void CalculateWhenIsSortedEqualsTruePassed()
        {
            var valuesPassed = new List <List <string> > {
                new List <string> {
                    "1", "2", "3"
                }, new List <string> {
                    "1", "2", "4"
                },
                new List <string> {
                    "1", "2", "3"
                }, new List <string> {
                    "3", "4", "5"
                }
            };
            var itemsToFind = new List <string> {
                "1", "3"
            };

            var expected = new Pairs <string> {
                Item = "1", Item2 = "3", Frequency = 2
            };

            var actual      = valuesPassed.CalculatePairs(itemsToFind, true);
            var actualStr   = JsonConvert.SerializeObject(actual);
            var expectedStr = JsonConvert.SerializeObject(expected);

            Assert.Equal(expectedStr, actualStr);
        }
Beispiel #12
0
        public override bool Equals(object obj)
        {
            var other = obj as JsonObject;

            return(other != null &&
                   Pairs.All(p => other.Keys.Contains(p.Key) && other[p.Key].Equals(p.Value)));
        }
 void InitPair(PersonPairNode pp)
 {
     pp.ExpandBranch = new UVMCommand(par => {
         if (pp.Male != null)
         {
             pp.MaleParentsPair = new PersonPairNode()
             {
                 X      = pp.X + 200,
                 Y      = pp.Y - 100,
                 Male   = pp.Male.Father,
                 Female = pp.Male.Mother
             };
             Pairs.Add(pp.MaleParentsPair);
             InitPair(pp.MaleParentsPair);
         }
         else
         {
             var person = CreatePersonDialogAsync(0);
             pp.Male    = (Person)person;
         }
         if (pp.Female != null)
         {
             pp.FemaleParentsPair = new PersonPairNode()
             {
                 X      = pp.X + 200,
                 Y      = pp.Y + 100,
                 Male   = pp.Female.Father,
                 Female = pp.Female.Mother
             };
             pairs.Add(pp.FemaleParentsPair);
             InitPair(pp.FemaleParentsPair);
         }
         RaisePropertyChanged("Pairs");
     });
 }
 public PersonTreeViewModel()
 {
     RootPair = new PersonPairNode()
     {
         X    = 50,
         Y    = 100,
         Male = new GRAppLib.DB.Person()
         {
             FirstName_ = "Alpha",
             BirthDate  = DateTime.Now,
             Father     = new Person()
             {
                 FirstName_ = "AlphaF"
             },
             Mother = new Person()
             {
                 FirstName_ = "AlphaM"
             }
         },
         Female = new GRAppLib.DB.Person()
         {
             FirstName_ = "Beta", BirthDate = DateTime.Now
         }
     };
     Pairs.Add(RootPair);
     RootPair.ExpandBranch.Execute(null);
 }
Beispiel #15
0
        public void TestPairsPairAmountLessThan100K()
        {
            var smth = new Pairs();

            int[] bigArray = new int[100];
            for (var i = 0; i < bigArray.Length; i += 1)
            {
                bigArray[i] = 5;
            }

            ////another way of populating big array, but hard to compare with expected results
            //int size = 5;
            //int[] randomNumbers = new int [size];
            //for (int i = 0; i < size; i++)
            //{
            //    Random r = new Random();
            //    randomNumbers[i] = r.Next(0, 9);
            //}

            int n      = bigArray.Length;
            var actual = smth.GetPairs(bigArray, n);

            var expected = 4950;

            _output.WriteLine(actual.ToString());
            Assert.Equal(expected, actual);
        }
    public static Pairs <string, object> Parse(string s)
    {
        var ret = new Pairs <string, object>();

        s = s.Trim();

        //check for enclosing brackets
        if (!Regex.Match(s, @"^{.*}$").Success)
        {
            throw new InvalidOperationException("[Jsonizer] Bad json format while parsing '" + s + "'");
        }

        //remove enclosing brackets
        s = s.Substring(1);
        s = s.Substring(0, s.Length - 1);

        //magic regex to parse exluding commas
        var datas = Regex.Matches(s, @"([\""].+?[\""]|\S+)\s*:\s*([\(].+?[\)]|[^,]+)")
                    .Cast <Match>()
                    .Select(m => m.Value);

        foreach (var data in datas)
        {
            ret.Add(ParsePart(data.Trim()));
        }

        return(ret);
    }
Beispiel #17
0
 /// <summary>Enumerate all candle data and time frames provided by this exchange</summary>
 protected override IEnumerable <PairAndTF> EnumAvailableCandleDataInternal(TradePair pair)
 {
     if (pair != null)
     {
         var cp = new CurrencyPair(pair.Base, pair.Quote);
         if (!Pairs.ContainsKey(pair.UniqueKey))
         {
             yield break;
         }
         foreach (var mp in Enum <EMarketPeriod> .Values)
         {
             yield return(new PairAndTF(pair, ToTimeFrame(mp)));
         }
     }
     else
     {
         foreach (var p in Pairs)
         {
             foreach (var mp in Enum <EMarketPeriod> .Values)
             {
                 yield return(new PairAndTF(p, ToTimeFrame(mp)));
             }
         }
     }
 }
Beispiel #18
0
    public static void Main(string[] args)
    {
        Table  env = new Table();
        Symbol k;
        object v;

        k      = Lua.Symbol.Intern("print");
        v      = new Print();
        env[k] = v;

        k      = Lua.Symbol.Intern("setmetatable");
        v      = new SetMetatable();
        env[k] = v;

        k      = Lua.Symbol.Intern("pairs");
        v      = new Pairs();
        env[k] = v;

        Lua.Symbol s = Lua.Symbol.Intern("tonumber");
        k      = s;
        v      = new ToNumber();
        env[k] = v;

        k = Lua.Symbol.Intern("os");
        Table os = new Table();

        v      = os;
        env[k] = v;
        k      = Lua.Symbol.Intern("clock");
        v      = new Clock();
        os[k]  = v;

        k = Lua.Symbol.Intern("io");
        Table io = new Table();

        v      = io;
        env[k] = v;
        k      = Lua.Symbol.Intern("write");
        v      = new Write();
        io[k]  = v;

        k = Lua.Symbol.Intern("math");
        Table math = new Table();

        v       = math;
        env[k]  = v;
        k       = Lua.Symbol.Intern("floor");
        v       = new Floor();
        math[k] = v;

        function1 f = new function1();

        f.Env = env;
        f.InvokeS();
        for (int i = 0; i <= System.GC.MaxGeneration; i++)
        {
            Console.WriteLine(System.GC.CollectionCount(i));
        }
    }
        internal IHtmlContent GenerateScripts()
        {
            string Scripts = string.Join(@",",
                                         Pairs.Select(p => $"'{p.Key}' : {html.Raw(formatObject(p.Value))}")
                                         );

            return(html.Raw($"var netcore_angular_pairs = {{{Scripts}}};"));
        }
 /// <summary>
 /// Get a <see cref="ColorSelectionFuncItem"/> which returns a random color pair given the available <see cref="NamedColorPair"/> pairings.
 /// </summary>
 /// <returns>Item</returns>
 ColorSelectionFuncItem RandomChoice()
 {
     return(new ColorSelectionFuncItem("Random Choice", (random) =>
     {
         var selected = Pairs.Random(random);
         return selected.Colors;
     }));
 }
Beispiel #21
0
        public void ToDictionary()
        {
            var dictionary = new[] { Pairs.Create("Hello", "World") }.ToDictionary();

            dictionary["Hello"]
            .Should()
            .Be("World");
        }
Beispiel #22
0
        public HttpConnectionString(string connectionString) : base(connectionString)
        {
            _Uri = new Lazy <string>(() =>
            {
                var ret = Pairs.GetFirstString("Uri") ?? Pairs.GetFirstWithoutKey();
                if (string.IsNullOrEmpty(ret))
                {
                    throw new ArgumentException("Uri parameter is expected");
                }
                return(ret);
            });

            _Timeout = new Lazy <int>(() =>
            {
                return(Pairs.GetFirstInt("Timeout", defVal: 30000, min: 1));
            });

            _Method = new Lazy <string>(() =>
            {
                return(Pairs.GetFirstString("Method") ?? "Get");
            });

            _Payload = new Lazy <string>(() =>
            {
                return(Pairs.GetFirstString("Payload"));
            });

            _ExpectedStatus = new Lazy <ExpectedStatusCodes>(() =>
            {
                string v = Pairs.GetFirstString("Valid Status");
                return(v == null ? ExpectedStatusCodes.Normal : new ExpectedStatusCodes(v));
            });

            _AllowUntrusted = new Lazy <bool>(() =>
            {
                return(Pairs.GetFirstBool("Allow Untrusted", true));
            });

            _Headers = new Lazy <IEnumerable <Header> >(() =>
            {
                var lookup = Pairs
                             .Where(x => x.HasKey && x.Key.TrimStart().StartsWith("*"))
                             .ToLookup(x => x.Key.TrimStart(), x => x.Value);

                List <Header> ret = new List <Header>();
                foreach (var item in lookup)
                {
                    ret.Add(new Header()
                    {
                        Name   = item.Key.Substring(1),
                        Values = new List <string>(item.ToList())
                    });
                }

                // if (Debugger.IsAttached && ConnectionString.IndexOf("Smart") >= 0) Debugger.Break();
                return(ret);
            });
        }
Beispiel #23
0
        public override T Get(string name)
        {
            if (!Pairs.ContainsKey(name))
            {
                Pairs.Add(name, base.Get(name));
            }

            return(Pairs[name]);
        }
Beispiel #24
0
        public string GetValForKey(string InKey)
        {
            if (Pairs.ContainsKey(InKey))
            {
                return(Pairs[InKey]);
            }

            return("");
        }
 public MappingGenerator GetReverse(string generatedNameSpace, string newDestinationGroup, AcessibilityLevelEnum?acessibility = null)
 {
     return(new MappingGenerator()
     {
         GeneratedNamespace = generatedNameSpace,
         DestinationGroup = newDestinationGroup ?? GetDestinationGroup(generatedNameSpace),
         Acessibility = acessibility == null ? Acessibility : acessibility.Value,
         Pairs = Pairs.Select(x => new KeyValuePair <Type, Type>(x.Value, x.Key))
     });
 }
Beispiel #26
0
        //Override Equals
        public override bool Equals(object obj)
        {
            Pairs item = obj as Pairs;

            if ((item.f1.Equals(this.f1)) && (item.f2.Equals(this.f2)))
            {
                return(true);
            }
            return(false);
        }
Beispiel #27
0
        /// <summary>
        /// Two rows are equal if they contain the same pairs in the same order.
        /// </summary>
        public override bool Equals(Object o)
        {
            if (!(o is ExpandedRow))
            {
                return(false);
            }
            ExpandedRow that = (ExpandedRow)o;

            return(Pairs.Equals(that.Pairs));
        }
Beispiel #28
0
        /// <summary>
        /// Two rows are equal if they contain the same pairs in the same order.
        /// </summary>
        override public bool Equals(Object o)
        {
            if (!(o is ExpandedRow))
            {
                return(false);
            }
            ExpandedRow that = (ExpandedRow)o;

            return(Pairs.Equals(that.Pairs) && IsReversed == that.IsReversed);
        }
Beispiel #29
0
    public static void Main(string[] args)
    {
        Table  env = new Table();
        Symbol k;
        object v;

        k      = Lua.Symbol.Intern("print");
        v      = new Print();
        env[k] = v;

        k      = Lua.Symbol.Intern("setmetatable");
        v      = new SetMetatable();
        env[k] = v;

        k      = Lua.Symbol.Intern("pairs");
        v      = new Pairs();
        env[k] = v;

        Lua.Symbol s = Lua.Symbol.Intern("tonumber");
        k      = s;
        v      = new ToNumber();
        env[k] = v;

        k = Lua.Symbol.Intern("os");
        Table os = new Table();

        v      = os;
        env[k] = v;
        k      = Lua.Symbol.Intern("clock");
        v      = new Clock();
        os[k]  = v;

        k = Lua.Symbol.Intern("io");
        Table io = new Table();

        v      = io;
        env[k] = v;
        k      = Lua.Symbol.Intern("write");
        v      = new Write();
        io[k]  = v;

        k = Lua.Symbol.Intern("math");
        Table math = new Table();

        v       = math;
        env[k]  = v;
        k       = Lua.Symbol.Intern("floor");
        v       = new Floor();
        math[k] = v;

        function1 f = new function1();

        f.Env = env;
        f.InvokeS();
    }
Beispiel #30
0
    public override string GetPageQuery(SearchPara para)
    {
        var pairs = new Pairs
        {
            { "page", $"{para.PageIndex}" },
            { "limit", $"{para.CountLimit}" },
            { "tags", para.Keyword.ToEncodedUrl() }
        };

        return($"{HomeUrl}/post.xml{pairs.ToPairsString()}");
    }
Beispiel #31
0
  public static void Main(string[] args) {
    Table env = new Table();
    Symbol k;
    object v;

    k = Lua.Symbol.Intern("print");
    v = new Print();
    env[k] = v;

    k = Lua.Symbol.Intern("setmetatable");
    v = new SetMetatable();
    env[k] = v;

    k = Lua.Symbol.Intern("pairs");
    v = new Pairs();
    env[k] = v;

    Lua.Symbol s = Lua.Symbol.Intern("tonumber");
    k = s;
    v = new ToNumber();
    env[k] = v;

    k = Lua.Symbol.Intern("os");
    Table os = new Table();
    v = os;
    env[k] = v;
    k = Lua.Symbol.Intern("clock");
    v = new Clock();
    os[k] = v;

    k = Lua.Symbol.Intern("io");
    Table io = new Table();
    v = io;
    env[k] = v;
    k = Lua.Symbol.Intern("write");
    v = new Write();
    io[k] = v;

    k = Lua.Symbol.Intern("math");
    Table math = new Table();
    v = math;
    env[k] = v;
    k = Lua.Symbol.Intern("floor");
    v = new Floor();
    math[k] = v;

    Closure c = (Closure)Assembly.LoadFrom(args[0] + ".dll").
      GetType(args[0] + ".function1").GetConstructor(new Type[0]).
      Invoke(new object[0]);
    c.Env = env;
    c.InvokeS();
    for(int i = 0; i <= System.GC.MaxGeneration; i++)
      Console.WriteLine(System.GC.CollectionCount(i));
  }
Beispiel #32
0
  public static void Main(string[] args) {
    Table env = new Table();
    Symbol k;
    object v;

    k = Lua.Symbol.Intern("print");
    v = new Print();
    env[k] = v;

    k = Lua.Symbol.Intern("setmetatable");
    v = new SetMetatable();
    env[k] = v;

    k = Lua.Symbol.Intern("pairs");
    v = new Pairs();
    env[k] = v;

    Lua.Symbol s = Lua.Symbol.Intern("tonumber");
    k = s;
    v = new ToNumber();
    env[k] = v;

    k = Lua.Symbol.Intern("os");
    Table os = new Table();
    v = os;
    env[k] = v;
    k = Lua.Symbol.Intern("clock");
    v = new Clock();
    os[k] = v;

    k = Lua.Symbol.Intern("io");
    Table io = new Table();
    v = io;
    env[k] = v;
    k = Lua.Symbol.Intern("write");
    v = new Write();
    io[k] = v;

    k = Lua.Symbol.Intern("math");
    Table math = new Table();
    v = math;
    env[k] = v;
    k = Lua.Symbol.Intern("floor");
    v = new Floor();
    math[k] = v;

    function1 f = new function1();
    f.Env = env;
    f.InvokeS();
    for(int i = 0; i <= System.GC.MaxGeneration; i++)
      Console.WriteLine(System.GC.CollectionCount(i));
  }
        /*static public void GetCompensation(SimpleScore out_comp, IntData fig, ZoneSwitcher zone, PairSwitcher pair)
        {
            if (out_comp == null)
                return;

            if (fig == null || !fig.IsDefined() || zone == null || !zone.IsDefined() || pair == null || !pair.IsDefined())
            {
                out_comp.Born = false;
            }
            else
            {
                int NS_figs, EW_figs;
                if (pair.Pair == Pairs.NS)
                {
                    NS_figs = fig.Value;
                    EW_figs = 40 - fig.Value;
                }
                else
                {
                    EW_figs = fig.Value;
                    NS_figs = 40 - fig.Value;
                }
                out_comp.SetScore(Compens(NS_figs, ZoneSwitcher.IsPairInZone(Pairs.NS, zone.Zone)), Compens(EW_figs, ZoneSwitcher.IsPairInZone(Pairs.EW, zone.Zone)));
            }
        }*/
        public static int CountFigurs(CardsDistribution cd, Pairs pair)
        {
            int count = 0;
            Quarters q;
            for (CardValue cv = CardValue.Jack; cv <= CardValue.Ace; cv++)
            {
                for (CardSuit cs = (CardSuit)0; cs < (CardSuit)4; cs++)
                {
                    q = cd.Get(cv, cs);
                    if (pair == Pairs.NS && (q == Quarters.N || q == Quarters.S) || pair == Pairs.EW && (q == Quarters.E || q == Quarters.W))
                        count += (cv - CardValue.Jack + 1);
                }
            }
            return count;
        }
        private static void EnsureEachLinkIsAnyOrExists(Pairs.Links links, params ulong[] sequence)
        {
            if (sequence == null)
                return;

            for (var i = 0; i < sequence.Length; i++)
                if (sequence[i] != Pairs.Links.Null && !links.Exists(sequence[i]))
                    throw new ArgumentLinkDoesNotExistsException<ulong>(sequence[i],
                        string.Format("patternSequence[{0}]", i));
        }
 public Sequences(Pairs.Links links)
 {
     _links = links;
 }
        public static int CountFits(CardsDistribution cd, Pairs pair, bool TenCardsIsTwoFits)
        {
            int count = 0; //кол-во фитов

            int[] sum = new int[4] { 0, 0, 0, 0 }; //сумма карт каждой масти
            Quarters q;
            for (CardSuit cs = (CardSuit)0; cs < (CardSuit)4; cs++)
            {
                for (CardValue cv = CardValue.Two; cv <= CardValue.Ace; cv++)
                {
                    q = cd.Get(cv, cs);

                    if (pair == Pairs.NS && (q == Quarters.N || q == Quarters.S) || pair == Pairs.EW && (q == Quarters.E || q == Quarters.W))
                        sum[(int)cs]++;
                }
            }

            for (int i = 0; i < 4; i++)
            {
                if (sum[i] >= 10 && TenCardsIsTwoFits)
                    count += 2;
                else if (sum[i] >= 8)
                    count++;
            }

            return count;
        }