예제 #1
0
        public void Shuffle()
        {
            int n = Cards.Count;

            while (n > 1)
            {
                n--;
                int  k     = GlobalRandom.GetRandomNumber(0, n + 1);
                Card value = Cards[k];
                Cards[k] = Cards[n];
                Cards[n] = value;
            }
        }
예제 #2
0
        public void RevealRandomCardInSummation()
        {
            List <Card> hiddenCards = new List <Card>();

            for (int i = 0; i < Cards.Count; ++i)
            {
                if (hiddenStatus[i])
                {
                    hiddenCards.Add(Cards[i]);
                }
            }

            int  randIdx = GlobalRandom.GetRandomNumber(0, hiddenCards.Count);
            Card card    = hiddenCards[randIdx];

            card.Revealed = true;
        }
예제 #3
0
        private void initJury()
        {
            // Generate list of markers.
            Dictionary <Property, int> aspectToNumMap = new Dictionary <Property, int>()
            {
                { Property.Protestant, GameConstants.NUM_PROTESTANT_MARKERS },
                { Property.Catholic, GameConstants.NUM_CATHOLIC_MARKERS },
                { Property.English, GameConstants.NUM_ENGLISH_MARKERS },
                { Property.French, GameConstants.NUM_FRENCH_MARKERS },
                { Property.Farmer, GameConstants.NUM_FARMER_MARKERS },
                { Property.Merchant, GameConstants.NUM_MERCHANT_MARKERS },
                { Property.GovWorker, GameConstants.NUM_GOVWORKER_MARKERS }
            };

            List <Property> religionAspectMarkers   = new List <Property>();
            List <Property> languageAspectMarkers   = new List <Property>();
            List <Property> occupationAspectMarkers = new List <Property>();

            foreach (Property aspect in new Property[] { Property.Protestant, Property.Catholic })
            {
                for (int i = 0; i < aspectToNumMap[aspect]; ++i)
                {
                    religionAspectMarkers.Add(aspect);
                }
            }
            foreach (Property aspect in new Property[] { Property.English, Property.French })
            {
                for (int i = 0; i < aspectToNumMap[aspect]; ++i)
                {
                    languageAspectMarkers.Add(aspect);
                }
            }
            foreach (Property aspect in new Property[] { Property.Farmer, Property.Merchant, Property.GovWorker })
            {
                for (int i = 0; i < aspectToNumMap[aspect]; ++i)
                {
                    occupationAspectMarkers.Add(aspect);
                }
            }

            // Create juries.
            List <int> jurySwaySpaces = new List <int>()
            {
                4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6
            };                                                                                 // Length of action point list will also determine number of juries. Should be 12.

            Debug.Assert(jurySwaySpaces.Count == GameConstants.NUM_TOTAL_JURY, "");

            int id = 0;

            foreach (int swaySpaces in jurySwaySpaces)
            {
                int religionIdx   = GlobalRandom.GetRandomNumber(0, religionAspectMarkers.Count);
                int languageIdx   = GlobalRandom.GetRandomNumber(0, languageAspectMarkers.Count);
                int occupationIdx = GlobalRandom.GetRandomNumber(0, occupationAspectMarkers.Count);

                Juries.Add(new Jury(id, swaySpaces, swaySpaces - 3, game, religionAspectMarkers[religionIdx], languageAspectMarkers[languageIdx], occupationAspectMarkers[occupationIdx]));

                religionAspectMarkers.RemoveAt(religionIdx);
                languageAspectMarkers.RemoveAt(languageIdx);
                occupationAspectMarkers.RemoveAt(occupationIdx);

                ++id;
            }
        }