Exemple #1
0
        public string ToStringOldCamelUpFormat()
        {
            //White2->Y  Yellow2 Blue3->O Orange3 Green4
            //;;wy;bo;g
            string retval = string.Empty;

            if (GetUnrolledCamelByRank().Length == 0)
            {
                int caseIndex = 0;
                for (int i = 0; i < BoardState.Length; i++)
                {
                    if (BoardState[i] == GameRules.CASE_SEPARATOR)
                    {
                        caseIndex++;
                    }
                    else if (GameRules.IsCharIdentityCamel(BoardState[i]))
                    {
                        retval += GameRules.FullNameCamel(BoardState[i]) + caseIndex;

                        if (BoardState.Length - 1 > i && GameRules.IsCharIdentityCamel(BoardState[i + 1]))
                        {
                            retval += "->" + Char.ToUpper(BoardState[i + 1]) + " ";
                        }

                        retval += " ";
                    }
                }
            }

            foreach (BoardDebug suBoard in m_SubBoard)
            {
                retval += suBoard.ToStringOldCamelUpFormat();
            }
            return(retval + "\t");
        }
        private Ev GenerateShortTermCardEv()
        {
            var highestCamelEv = m_CamelRankManager.GetHighestEv(m_CamelCards);
            Ev  retval         = new Ev
            {
                m_PlayerAction = GameRules.PlayerAction.PickShortTermCard,
                m_Ev           = highestCamelEv.Item2,
                m_Info         = GameRules.FullNameCamel(highestCamelEv.Item1)
            };

            return(retval);
        }
        public Ev GetEv()
        {
            Dictionary <char, double[]> camelRanks          = GetAverageCamelRankInfo();
            Tuple <char, double>        highestEvFirstPlace = new Tuple <char, double>('x', -10f);
            Tuple <char, double>        highestEvLastPlace  = new Tuple <char, double>('x', -10f);

            foreach (var cr in camelRanks)
            {
                double ev = LongTermCardGuesser.Instance.GetPriceForFirst(cr.Key) * cr.Value[0];
                if (ev > highestEvFirstPlace.Item2)
                {
                    highestEvFirstPlace = new Tuple <char, double>(cr.Key, ev);
                }

                ev = LongTermCardGuesser.Instance.GetPriceForLast(cr.Key) * cr.Value[4];                //todo magic number
                if (ev > highestEvLastPlace.Item2)
                {
                    highestEvLastPlace = new Tuple <char, double>(cr.Key, ev);
                }
            }

            Tuple <char, double> highest;
            bool isFirst;

            if (highestEvFirstPlace.Item2 > highestEvLastPlace.Item2)
            {
                highest = highestEvFirstPlace;
                isFirst = true;
            }
            else
            {
                highest = highestEvLastPlace;
                isFirst = false;
            }

            string info = String.Format("{0} cards pour le {1}, avec une proportion de {2}",
                                        isFirst? "First" : "Last", GameRules.FullNameCamel(highest.Item1), GetTotalProportionAllRankManagers);

            Ev retval = new Ev
            {
                m_PlayerAction = GameRules.PlayerAction.PickLongTermCard,
                m_Ev           = (float)highest.Item2,
                m_Info         = info
            };

            return(retval);
        }