Beispiel #1
0
        public void CopyMoves(ref cMoveClass cMC)
        {
            cMoveData cmd;
            cMoveInfo cmi;

            TheseMoves.Clear();
            ThisMoveInfo.Clear();
            for (int i = 0; i < cMC.TheseMoves.Count; i++)
            {
                cMoveData dcMC = cMC.TheseMoves[i];
                cmd            = new cMoveData(dcMC.ID, dcMC.Src, dcMC.Des, dcMC.Score, dcMC.bWasFacedown, dcMC.NumMoved);
                cmd.ShrinkCode = dcMC.ShrinkCode;
                cmd.WhereInfo  = dcMC.WhereInfo;
                TheseMoves.Add(cmd);
            }
            for (int i = 0; i < cMC.ThisMoveInfo.Count; i++)
            {
                cmi                 = new cMoveInfo();
                cmi.deal            = cMC.ThisMoveInfo[i].deal;
                cmi.id              = cMC.ThisMoveInfo[i].id;
                cmi.MinutesLastDeal = cMC.ThisMoveInfo[i].MinutesLastDeal;
                cmi.suit            = cMC.ThisMoveInfo[i].suit;
                cmi.suiter          = cMC.ThisMoveInfo[i].suiter;
                cmi.score           = cMC.ThisMoveInfo[i].score;
                cmi.TimeOfMove      = cMC.ThisMoveInfo[i].TimeOfMove;
                ThisMoveInfo.Add(cmi);
            }
            InitialCardTime = cMC.InitialCardTime;
            LastBuildTime   = cMC.LastBuildTime;
            LastDealTime    = cMC.LastDealTime;
            bOnFirstBuild   = cMC.bOnFirstBuild;
            bOnFirstDeal    = cMC.bOnFirstDeal;
        }
Beispiel #2
0
        public int HasInfo(int i, ref string[] strOut)
        {
            Debug.Assert(i >= 0);
            cMoveInfo thisMI = ThisMoveInfo[i];
            int       RtnCod = 0;

            //DateTime LastTimeOfWhatever = FindLastTime(i, thisMI.id);

            switch (thisMI.id)
            {
            case GlobalClass.FIRST_CARD:
                strOut    = new string[1];
                strOut[0] = "First (" + thisMI.deal + ")";
                RtnCod    = 1;
                break;

            case GlobalClass.DEALT_A_CARD:      // is always appended to the last move
                strOut    = new string[3];
                strOut[0] = "Deal# " + thisMI.deal;
                strOut[1] = "Min: " + thisMI.MinutesLastDeal;
                strOut[2] = "Best:" + thisMI.score;
                RtnCod    = 2;
                break;

            case GlobalClass.BUILT_SUIT:      // is always appended to the last move
                //strOut = new string[3];
                //strOut[0] = "Suit " + GlobalClass.SuitNames[thisMI.suit];
                //strOut[1] = "Min:" + thisMI.MinutesLastDeal.ToString("0");
                //strOut[2] = "By:" + utils.SetCompletedBy((GlobalClass.TypeCompletedBy)thisMI.suiter);
                strOut    = new string[1];
                strOut[0] = "S" + GlobalClass.SuitNames[thisMI.suit].Substring(0, 1) +
                            thisMI.MinutesLastDeal.ToString("0") +
                            utils.SetCompletedBy((GlobalClass.TypeCompletedBy)thisMI.suiter);
                RtnCod = 3;
                break;

            default: Debug.Assert(false);
                break;
            }
            return(RtnCod);
        }
Beispiel #3
0
        // on FIRST_CARD vInfo is the number of deals, if any, before the first card
        // on BUILT_SUIT vInfo is the suit and vInfo1 the id of the suit builder
        // on DEALT_CARD vInfo is the score and vInfo1 is the dealcounter
        public void AddMoveInfo(int iInfo, int vInfo, int vInfo1)
        {
            cMoveInfo thisMI = new cMoveInfo();

            switch (iInfo)
            {
            case GlobalClass.FIRST_CARD:
                InitialCardTime = DateTime.Now;
                return;                    // cannot add anything since there have been no cards moved.  just record time

            case GlobalClass.DEALT_A_CARD: // is always appended to the last move

                thisMI.score      = vInfo;
                thisMI.deal       = vInfo1;
                thisMI.TimeOfMove = DateTime.Now;
                if (bOnFirstDeal)
                {
                    LastDealTime = InitialCardTime;
                }
                ts = thisMI.TimeOfMove.Subtract(LastDealTime);
                thisMI.MinutesLastDeal = Convert.ToInt32(ts.TotalMinutes);
                LastDealTime           = thisMI.TimeOfMove;
                bOnFirstDeal           = false;
                break;

            case GlobalClass.BUILT_SUIT:      // is always appended to the last move
                thisMI.suit       = vInfo;
                thisMI.suiter     = vInfo1;
                thisMI.TimeOfMove = DateTime.Now;
                if (bOnFirstBuild)
                {
                    LastBuildTime = InitialCardTime;
                }
                ts = thisMI.TimeOfMove.Subtract(LastBuildTime);
                thisMI.MinutesLastDeal = Convert.ToInt32(ts.TotalMinutes);
                LastBuildTime          = thisMI.TimeOfMove;
                bOnFirstBuild          = false;
                break;

            default: Debug.Assert(false);
                break;
            }
            thisMI.id = iInfo;
            // jys nov2012 the problem is the deal is not added if there are no moves!!!!
            // cannot append if there are no moves
            if (TheseMoves.Count > 0)
            {
                TheseMoves[TheseMoves.Count - 1].WhereInfo = ThisMoveInfo.Count;
            }
            else
            {
                if (iInfo == GlobalClass.DEALT_A_CARD)
                {
                    cMoveData cm = new cMoveData(GlobalClass.DEALT_A_CARD, -1, -1, -1, true, 0);
                    TheseMoves.Add(cm);
                    TheseMoves[TheseMoves.Count - 1].WhereInfo = ThisMoveInfo.Count;
                }
            }
            if (ThisMoveInfo.Count > 0) // THIS CODE IS FOR DEBUGGING (BREAKPOINTS)
            {
                int iCnt = ThisMoveInfo.Count - 1;
                if (ThisMoveInfo[iCnt].id == GlobalClass.DEALT_A_CARD && thisMI.id == GlobalClass.DEALT_A_CARD)
                {
                    iCnt = 0;
                }
            }
            ThisMoveInfo.Add(thisMI);
        }