示例#1
0
        public DrawMachine3(List <Player> ply, List <Pairing> _History, int _Rnd,
                            int _MaxHandi = 9, int _AdjHandi = 1, bool _HandiAboveBar = false, bool _Verbose = false)
        {
            Verbose = _Verbose;
            plys.AddRange(ply); //Careful with Byes
            History     = _History;
            lookUpTable = new int[ply.Count];
            Pairs       = new List <Pairing>();
            Pairing.setStatics(_MaxHandi, _AdjHandi, _HandiAboveBar);
            // plys.Sort(); //just in case
            foreach (Player pd in plys)
            {
                if (pd.getParticipation(_Rnd - 1))
                {
                    totalPairs++;
                }
            }
            List <Player> takingABye = new List <Player>();

            foreach (Player pd in plys)
            {
                if (pd.getParticipation(_Rnd - 1) == false) //0 based
                {
                    takingABye.Add(pd);
                }
            }
            foreach (Player tab in takingABye)
            {
                plys.Remove(tab);
            }
            totalPairs = totalPairs / 2;
            //i want to search for Seed and see player
            for (int i = 0; i < plys.Count; i++)
            {
                lookUpTable[plys[i].Seed - 1] = i;
            }
            //end DO WE NEED
            _Split = new List <SplitLayer>();
            //populate Split layers which use Seed and not Deed
            _Split.Add(new SplitLayer(plys[0].getSwiss(), plys[0].Seed));
            for (int i = 1; i < plys.Count; i++)
            {
                if (plys[i].getSwiss() == _Split[_Split.Count - 1].SwissKey)
                {
                    _Split[_Split.Count - 1].Add(plys[i].Seed);
                }
                else
                {
                    _Split.Add(new SplitLayer(plys[i].getSwiss(), plys[i].Seed));
                }
            }
            if (Verbose)
            {
                DebugSplit();
            }
            DRAW();
        }
示例#2
0
        public DrawMachine1(List <Player> ply, List <Pairing> _History,
                            int _MaxHandi = 9, int _AdjHandi = 1, bool _HandiAboveBar = false, bool _Verb = false)
        {
            Verbose       = _Verb;
            plys          = ply;
            History       = _History;
            LookUpTable   = new int[ply.Count];
            LookUpBull    = new bool[ply.Count];
            Pairs         = new List <Pairing>();
            MaxHandi      = _MaxHandi;
            AdjHandi      = _AdjHandi;
            HandiAboveBar = _HandiAboveBar;
            Pairing.setStatics(MaxHandi, AdjHandi, HandiAboveBar);
            plys.Sort(); //just in case
            int d = 0;

            foreach (Player pp in plys)
            {
                LookUpBull[d] = false;
                pp.Deed       = d++;
            }
            BigM = new List <McLayer>();
            //populate BigM
            BigM.Add(new McLayer(plys[1].getSwiss(), plys[1].Deed));
            for (int i = 2; i < plys.Count; i++)
            {
                if (plys[i].getSwiss() == BigM[BigM.Count - 1].SwissKey)
                {
                    BigM[BigM.Count - 1].Add(plys[i].Deed);
                }
                else
                {
                    BigM.Add(new McLayer(plys[i].getSwiss(), plys[i].Deed));
                }
            }
            //Shuffle
            foreach (McLayer mcl in BigM)
            {
                mcl.Shuffle();
            }
            for (int j = 0; j < LookUpTable.Length; j++)
            {
                LookUpTable[plys[j].Deed] = j;
            }
            DRAW();
        }