Example #1
0
 public static extern int CalcDDtablePBN(DdTableDealPbn tableDealPbn, ref DdTableResults tablep);
Example #2
0
        public List<Contract> CalculateMakeableContracts(string pbn)
        {
            var ret = new List<Contract>();
            var results = new DdTableResults();
            var dto = new DdTableDealPbn(DdsHelper.PbnStringToChars(pbn));

            var res = DdsImport.CalcDDtablePBN(dto, ref results);
            if (res != 1)
                throw new DdsCalcDDtableException(res);
            /* 
            *      S   H   D   C   NT
            *  N   0   4   8   12  16
            *  E   1   5   9   13  17
            *  S   2   6   10  14  18
            *  W   3   7   11  15  19
            */

            var index = 0;
            foreach (Trump trump in Trump.Trumps)
            {
                foreach (PlayerPosition player in PlayerPosition.Players)
                {
                    ret.Add(new Contract()
                    {
                        Trump = trump,
                        PlayerPosition = player,
                        Value = results.resTable[index]
                    });
                    index++;
                }
            }

            return ret;
        }