예제 #1
0
        public override Chromosome Cross(Chromosome chromosome1, Chromosome chromosome2)
        {
            if (chromosome1.Bitstring.Length != chromosome2.Bitstring.Length)
            {
                throw new Exception("The two bitstrings to be crossed must have the same length.");
            }

            bool[] result     = new bool[chromosome1.Bitstring.Length];
            int    crossPoint = RandomNum.RandomInt(1, chromosome1.Bitstring.Length - 1);

            bool[] left, right;
            if (RandomNum.RandomBool())
            {
                left  = chromosome1.Bitstring;
                right = chromosome2.Bitstring;
            }
            else
            {
                left  = chromosome2.Bitstring;
                right = chromosome1.Bitstring;
            }
            for (int i = 0; i < crossPoint; i++)
            {
                result[i] = left[i];
            }
            for (int i = crossPoint; i < chromosome1.Bitstring.Length; i++)
            {
                result[i] = right[i];
            }

            //return new chromosome
            return(new Chromosome(result));
        }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     for (int i = 0; i < AmountBalloons; i++)
     {
         Instantiate(BalloonPrefab, new Vector3(RandomNum.GetRandom(-border, border), 0, RandomNum.GetRandom(-border, border)), Quaternion.Euler(270, 0, 0));
     }
 }
예제 #3
0
        //define a trigger event
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            //catch the exception
            try
            {
                SO       = Convert.ToDouble(this.So.Text);
                K        = Convert.ToDouble(this.k.Text);
                sigma    = Convert.ToDouble(this.Sigma.Text);
                r        = Convert.ToDouble(this.R.Text);
                T        = Convert.ToDouble(this.Tenor.Text);
                TrailNum = Convert.ToInt32(this.Trail.Text);
                StepNum  = Convert.ToInt32(this.Step.Text);

                double[,] Randoms = RandomNum.RandomSet(TrailNum, StepNum);
                double[] EurpCall   = EuropOption.PriceEurp(SO, K, sigma, r, T, StepNum, TrailNum, Randoms);
                double[] GreekValue = Greek.Greeks(SO, K, sigma, r, T, StepNum, TrailNum, Randoms);
                string   OutPut;
                //output the results
                OutPut = Convert.ToString("EurCallprice : " + EurpCall[0] + "\n" + "EurPutprice : " + EurpCall[1] + "\n" + "EurCallStdEr : " + EurpCall[2] + "\n" + "EurPutStdEr : " + EurpCall[3] + "\n" + "EurCallDelta : " + GreekValue[0] + "\n" + "EurPutDelta : " + GreekValue[1] + "\n" + "EurCallGamma : " + GreekValue[2] + "\n" + "EurPutGamma : " + GreekValue[3] + "\n" + "EurCallVega : " + GreekValue[4] + "\n" + "EurPutVega : " + GreekValue[5] + "\n" + "EurCallTheta : " + GreekValue[6] + "\n" + "EurPutTheta : " + GreekValue[7] + "\n" + "EurCallRho : " + GreekValue[8] + "\n" + "EurPutRho : " + GreekValue[9]);
                MessageBox.Show(OutPut);
            }
            catch (Exception)
            {
                MessageBox.Show("All the inputs need to be numbers.");
            }
        }
예제 #4
0
    public string NewName()
    {
        char[] alpha        = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
        var    NewRobotName = new List <string>();
        var    random       = new Random();
        int    RandomNum;
        int    RandomIndex;

        for (int i = 0; i < 5; i++)
        {
            if (i < 2)
            {
                RandomIndex = random.Next(0, alpha.Count());
                NewRobotName.Add(alpha[RandomIndex].ToString());
            }
            else
            {
                RandomNum = random.Next(0, 10);
                NewRobotName.Add(RandomNum.ToString());
            }
        }
        var NewRobotNameJoined = string.Join("", NewRobotName);

        return(NewRobotNameJoined);
    }
예제 #5
0
        public double MeasureDiversity(SortList <AIPlayer> individuals)
        {
            int outputSize = individuals.Get(0).neuralNetwork.GetNumberOfOutputs();

            double diversity = 0;

            for (int j = 0; j < runs; j++)
            {
                double[] randInputs = new double[individuals.Get(0).neuralNetwork.GetNumberOfInputs()];
                for (int i = 0; i < randInputs.Length; i++)
                {
                    randInputs[i] = RandomNum.RandomDouble();
                }

                //We use a dictionary to keep track of the size of each specie we encounter
                Dictionary <int, int> counters = new Dictionary <int, int>();
                for (int l = 0; l < individuals.Count; l++)
                {
                    int specie = CalcSpecie(individuals.Get(l).GetOutputs(randInputs));
                    if (counters.Keys.Contains(specie))
                    {
                        counters[specie]++;
                    }
                    else
                    {
                        counters.Add(specie, 1);
                    }
                }

                //Use simpsons diversity
                diversity += CalcSimpsonsDiversity(counters);
            }

            return(diversity / runs);
        }
예제 #6
0
    public static void Main()
    {
        SelectionSort selectS = new SelectionSort();

        RandomNum rNA = new RandomNum();

        ExecutionTimer eT = new ExecutionTimer(); // to test execution time


        // int[] array = new int[] { 3,1,4,6,7,5,2 };

        // random number generator for array (initialize & instantiate)
        //int[] test = rNA.RandNumArrGen(5, 100);
        int[] test2 = rNA.RandNumArrGen(10, 100);
        // int[] test3 = rNA.RandNumArrGen(10, 25);

        // ***** Tests for selectionsort() *****
        //

        eT.startTimer();

        selectS.selectionsort(test2);

        eT.stopTimer();
        eT.elapsedTime();
    } //main
예제 #7
0
    public async Task Riddle()
    {
        // No log for current or previous channel sessions
        if (!sessions.ContainsKey(Context.Channel.Id))
        {
            // Add session to session list
            sessions.Add(Context.Channel.Id, new Session(RandomNum.Rand(0, riddles.Length), new List <int>(), 0));

            // Give riddle to user
            await ReplyAsync(riddles[sessions[Context.Channel.Id].CurrentRiddle].Main);
        }

        // Log exists and the previous riddle was solved
        else if (sessions[Context.Channel.Id].CurrentRiddle < 0)
        {
            // Get random riddle not yet played
            do
            {
                currentRiddle = RandomNum.Rand(0, riddles.Length);
            } while (sessions[Context.Channel.Id].PreviousRiddles.Contains(currentRiddle));

            // Save current riddle to session
            sessions[Context.Channel.Id].CurrentRiddle = currentRiddle;

            // Give riddle to user
            await ReplyAsync(riddles[currentRiddle].Main);
        }

        // No log and previous riddle was not solved
        else
        {
            await ReplyAsync(data[13]);
        }
    }
예제 #8
0
    public async Task NewRiddle()
    {
        // There is a current riddle session
        if (sessions.ContainsKey(Context.Channel.Id))
        {
            // Reset session variables
            Reset(Context.Channel.Id);

            // Riddles were previously solved
            if (sessions[Context.Channel.Id].PreviousRiddles.Count > 0)
            {
                do
                {
                    currentRiddle = RandomNum.Rand(0, riddles.Length);
                } while (sessions[Context.Channel.Id].PreviousRiddles.Contains(currentRiddle));
            }
            else
            {
                currentRiddle = RandomNum.Rand(0, riddles.Length);
            }

            // Save current riddle to session
            sessions[Context.Channel.Id].CurrentRiddle = currentRiddle;

            // Show riddle in chat
            await ReplyAsync(data[18]);
            await ReplyAsync(riddles[sessions[Context.Channel.Id].CurrentRiddle].Main);
        }
        else
        {
            currentRiddle = RandomNum.Rand(0, riddles.Length);
            sessions.Add(Context.Channel.Id, new Session(currentRiddle, new List <int>(), 0));
            await ReplyAsync(riddles[sessions[Context.Channel.Id].CurrentRiddle].Main);
        }
    }
예제 #9
0
        private Party GetParty(Party party)
        {
            if (party.Members.Length <= 3)
            {
                return(party);
            }
            Member[] random = new Member[3];
            for (int i = 0; i < 3; i++)
            {
                if (!party.LeaderSwap && i == 0)
                {
                    random[i] = party.Members[i];
                    continue;
                }

                Member m;
                do
                {
                    m = party.Members[RandomNum.RandInt(0, party.Members.Length - 1)];
                } while (random.Contains(m));
                random[i] = m;
            }

            return(new Party(party.MaxStage, party.LeaderSwap, random));
        }
예제 #10
0
        private Tuple <Item, int> GetItem(Item item, int rankAdj)
        {
            int rank = TieredItems.manager.GetRank(item, radioEnemy.Checked ? 1 : (int)numericCount.Value);

            if (rank != -1)
            {
                if (rankAdj > 0)
                {
                    rank = RandomNum.RandInt(Math.Max(0, rank - rankAdj), Math.Min(TieredItems.manager.GetHighBound(), rank + rankAdj));
                }
                int oldRank = rank + 0;
                Tuple <Item, int> newItem;
                do
                {
                    newItem = TieredItems.manager.Get(rank, radioEnemy.Checked ? 1 : Int32.MaxValue, tiered => GetWeight(tiered, item));
                    rank--;
                } while ((newItem.Item1 == null || blacklistedWeapons.Contains(newItem.Item1)) && rank >= 0);
                if (newItem.Item1 == null)
                {
                    return(null);
                }
                return(newItem);
            }
            return(null);
        }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     alienspawn    = GameObject.FindGameObjectWithTag("Respawn");
     floatScript   = alienspawn.GetComponent <RandomNum>();
     shooterspawn  = GameObject.FindGameObjectWithTag("ShooterRespawn");
     shooterScript = shooterspawn.GetComponent <ShooterSpawn>();
 }
예제 #12
0
 public void SetRemaining(List <DataStoreCrystarium> list)
 {
     foreach (string name in CharNames)
     {
         DataStoreWDB <DataStoreCrystarium, DataStoreIDCrystarium> crystarium = crystariums[name];
         foreach (DataStoreCrystarium c in list)
         {
             if (!(c.Type == CrystariumType.HP || c.Type == CrystariumType.Strength || c.Type == CrystariumType.Magic))
             {
                 int stage = c.Stage;
                 List <DataStoreCrystarium> others;
                 do
                 {
                     others = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }.SelectMany(t => crystarium.DataList.Where(o => o.Role == c.Role && o.Stage == stage && o.Type == t)).ToList();
                     stage--;
                 } while (others.Count == 0 && stage > 0);
                 if (others.Count > 0)
                 {
                     DataStoreCrystarium other = others[RandomNum.RandInt(0, others.Count - 1)];
                     c.Type  = other.Type;
                     c.Value = other.Value;
                 }
                 else
                 {
                     c.Type  = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }[RandomNum.RandInt(0, 2)];
                     c.Value = 1;
                 }
             }
         }
     }
 }
예제 #13
0
        public override Chromosome Cross(Chromosome chromosome1, Chromosome chromosome2)
        {
            if (chromosome1.Bitstring.Length != chromosome2.Bitstring.Length)
            {
                throw new Exception("The two bitstrings must have same length to be crossed");
            }
            bool[] result        = new bool[chromosome1.Bitstring.Length];
            int    ancestor1bits = 0;

            for (int i = 0; i < chromosome1.Bitstring.Length; i++)
            {
                if (RandomNum.RandomBool())
                {
                    result[i] = chromosome1.Bitstring[i];
                    ancestor1bits++;
                }
                else
                {
                    result[i] = chromosome2.Bitstring[i];
                }
            }


            //return the new chromosome string
            return(new Chromosome(result));
        }
예제 #14
0
        private void RandomizeTPCosts(Dictionary <Ability, int> plando)
        {
            if (Flags.AbilityFlags.TPCost)
            {
                int variance = Flags.AbilityFlags.TPCost.Range.Value;
                Flags.AbilityFlags.TPCost.SetRand();

                Abilities.abilities.Where(a => a.Role == Role.None).ForEach(aID =>
                {
                    if (abilities.IdList.IndexOf(aID.GetIDs()[0]) > -1)
                    {
                        int max  = 5;
                        int cost = plando.ContainsKey(aID) ? (plando[aID] * 10) : abilities[aID.GetIDs()[0]].ATBCost;
                        if (!plando.ContainsKey(aID))
                        {
                            cost = RandomNum.RandInt(Math.Max(1, cost / 10 - variance), Math.Min(max, cost / 10 + variance)) * 10;
                        }

                        aID.GetIDs().ForEach(id =>
                        {
                            if (abilities.IdList.IndexOf(id) > -1)
                            {
                                abilities[id].ATBCost = (ushort)cost;
                            }
                        });
                    }
                });
                RandomNum.ClearRand();
            }
        }
예제 #15
0
 public void Noise(float rate, byte val = 255)
 {
     for (int i = 0; i < DataSize(); i++)
     {
         if (RandomNum.Roll(rate))
         {
             Datas[i] = val;
         }
     }
 }
예제 #16
0
파일: Shapes.cs 프로젝트: zsabbasi/Shapes
        public Triangle(ImageWriter writer)
            : base(writer)
        {
            int x  = RandomNum.Next(150, 500);
            int x1 = RandomNum.Next(150, 600);
            int y  = RandomNum.Next(500, 680);
            int y1 = RandomNum.Next(440, 580);

            this.Vertices = new PointF[] { new PointF(x, y), new PointF(x1, y1), new PointF(x, y1) };
        }
예제 #17
0
파일: Shapes.cs 프로젝트: zsabbasi/Shapes
        public Pentagon(ImageWriter writer)
            : base(writer)
        {
            int y  = RandomNum.Next(483, 600);
            int y2 = RandomNum.Next(350, 400);
            int y3 = RandomNum.Next(370, 590);
            int y4 = RandomNum.Next(270, 300);

            this.Vertices = new PointF[] { new PointF(413, y), new PointF(370, y2), new PointF(480, y4), new PointF(590, y2), new PointF(550, y) };
        }
예제 #18
0
파일: Shapes.cs 프로젝트: zsabbasi/Shapes
        public Line(ImageWriter writer)
            : base(writer)
        {
            int x  = RandomNum.Next(300, 600);
            int x1 = RandomNum.Next(300, 600);
            int y  = RandomNum.Next(600, 700);
            int y1 = RandomNum.Next(600, 700);

            this.Vertices = new PointF[] { new PointF(x, y), new PointF(x1, y1) };
        }
예제 #19
0
 public override void Randomize(BackgroundWorker backgroundWorker)
 {
     newSoundFiles.AddRange(soundFiles);
     if (Flags.Other.Music)
     {
         Flags.Other.Music.SetRand();
         newSoundFiles.Shuffle();
         RandomNum.ClearRand();
     }
 }
예제 #20
0
        private void RandomizeDrop(DataStoreEnemy enemy, Enemy enemyID, bool common, Dictionary <Enemy, Tuple <Item, Item> > plando)
        {
            int  rankAdj = Flags.ItemFlags.Drops.Range.Value;
            Item item    = null;

            if (!string.IsNullOrEmpty(common ? enemy.CommonDropID : enemy.RareDropID))
            {
                item = Items.items.Where(i => i.ID ==
                                         (common ? enemy.CommonDropID : enemy.RareDropID)).FirstOrDefault();
            }
            if (item != null)
            {
                if (item.ID == "")
                {
                    throw new Exception("LUL");
                }
                int rank = TieredItems.manager.GetRank(item, 1);
                if (rank != -1)
                {
                    Tuple <Item, int> newItem;
                    if (plando.ContainsKey(enemyID) && (common ? plando[enemyID].Item1 : plando[enemyID].Item2) != null)
                    {
                        newItem = new Tuple <Item, int>(common ? plando[enemyID].Item1 : plando[enemyID].Item2, 1);
                    }
                    else
                    {
                        if (rankAdj > 0)
                        {
                            rank = RandomNum.RandInt(Math.Max(0, rank - rankAdj), Math.Min(TieredItems.manager.GetHighBound(), rank + rankAdj));
                        }
                        do
                        {
                            newItem = TieredItems.manager.Get(rank, 1, tiered => GetDropWeight(tiered, enemy.Level, enemyID.Type, item.ID.StartsWith("it") && enemy.Level > 50));
                            rank--;
                        } while ((newItem.Item1 == null || randomizers.Get <RandoTreasure>("Treasures").blacklistedWeapons.Contains(newItem.Item1)) && rank >= 0);
                    }
                    if (newItem.Item1 == null)
                    {
                        return;
                    }
                    if (newItem.Item1.ID.StartsWith("wea_"))
                    {
                        randomizers.Get <RandoTreasure>("Treasures").blacklistedWeapons.Add(newItem.Item1);
                    }
                    if (common)
                    {
                        enemy.CommonDropID = newItem.Item1.ID;
                    }
                    else
                    {
                        enemy.RareDropID = newItem.Item1.ID;
                    }
                }
            }
        }
예제 #21
0
    public static void Main()
    {
        RandomNum rNA = new RandomNum();

        BubbleSort bs = new BubbleSort();

        InOut <int> hello = new InOut <int>();    // generic class

        ExecutionTimer eT = new ExecutionTimer(); // to test execution time

        // Requires User's Interaction *** *** ***
        //
        // Console.WriteLine( "Input the quanity or amount of numbers to sort: " );
        //
        // int size = hello.AskUserMore(); // NON-generic function
        //
        // Console.WriteLine( "Input the upper limit (not inclusive) of the range that the generator can randomize e.g. 0 to ? : " );
        //
        // int max = hello.AskUserMore(); // NON-generic function
        //
        // // random number generator for array (initialize & instantiate)
        // int[] test = rNA.RandNumArrGen(size, max);
        //
        // rNA.showArrayValues( test );
        //
        // bs.bubblesorting( test );
        //
        // System.Console.WriteLine("After sorting: ");
        //
        // rNA.showArrayValues( test );
        //
        // End of Requires User's Interaction *** *** ***


        int[] test2 = rNA.RandNumArrGen(100, 100);
        rNA.showArrayValues(test2);

        eT.startTimer();

        bs.bubblesorting(test2);

        eT.stopTimer();
        eT.elapsedTime();

        rNA.showArrayValues(test2);

        ////////////////////////////////
        // Time execution conclusion: //
        ////////////////////////////////
        //
        // RunTime 00:00:00.0000  ( for almost all tests with 100 elements )
        // Output:
        // 0 0 4 4 5 6 7 8 10 12 13 14 15 17 17 18 18 18 19 19 20 20 22 22 22 24 25 26 26 26 27 27 28 28 28 29 31 31 31 32 34 34 34 40 41 41 43 43 43 45 46 46 46 47 47 48 51 51 52 52 53 53 57 58 65 65 66 67 67 70 71 71 71 71 72 72 72 74 75 75 75 78 80 81 81 81 84 87 87 89 89 91 93 96 96 98 98 98 99 99
        //
    }
예제 #22
0
        private Dictionary <Item, Tuple <float, float> > GetWeaponMults(Dictionary <Item, PassiveSet> plandoPassives, Dictionary <Character, List <PassiveSet> > sets)
        {
            Dictionary <Item, Tuple <float, float> > weaponMults = Items.items.Where(i => i.ID.StartsWith("wea") && i.EquipPassive.Item2 == 0).ToDictionary(i => i, i =>
            {
                PassiveSet s;
                if (plandoPassives.ContainsKey(i))
                {
                    s = plandoPassives[i];
                }
                else if (i.EquipPassive.Item1.LockingLevel == LockingLevel.Fixed)
                {
                    s = i.EquipPassive.Item1;
                }
                else
                {
                    s = sets[GetCharacter(i.ID)][0];
                    sets[GetCharacter(i.ID)].RemoveAt(0);
                }
                if (s.GetPassiveDirect(0, Int32.MaxValue).StrengthModifier > 0 && s.GetPassiveDirect(0, Int32.MaxValue).MagicModifier > 0)
                {
                    if (RandomNum.RandInt(0, 100) < 3)
                    {
                        if (RandomNum.RandInt(0, 100) < 50)
                        {
                            return(new Tuple <float, float>(1.5f, 0));
                        }
                        else
                        {
                            return(new Tuple <float, float>(0, 1.5f));
                        }
                    }
                    else
                    {
                        StatValues strMag = new StatValues(2);
                        strMag.Randomize(75, 0.6f);
                        return(new Tuple <float, float>(strMag[0] / 100f, strMag[1] / 100f));
                    }
                }
                return(new Tuple <float, float>(1, 1));
            });

            weaponMults.Keys.ToList().Where(i => equips[i].UpgradeInto != "").ForEach(i =>
            {
                for (Item i2 = Items.items.Find(i3 => i3.ID == equips[i].UpgradeInto); ; i2 = Items.items.Find(i3 => i3.ID == equips[i2].UpgradeInto))
                {
                    weaponMults.Add(i2, weaponMults[i]);
                    if (equips[i2].UpgradeInto == "")
                    {
                        break;
                    }
                }
            });
            return(weaponMults);
        }
예제 #23
0
        public User GenerateUser()
        {
            var result = new User {
                FirstName = RandomFname, LastName = RandomLname
            };
            var randomnumber = RandomNum.ToString(System.Globalization.CultureInfo.InvariantCulture);
            var domain       = RandomDomain;
            var domainType   = RandomDomainType;

            result.Email = CreateAcctEmail(result.FirstName, result.LastName, randomnumber, domain, domainType);
            return(result);
        }
예제 #24
0
 public void ShuffleAnyRole(Dictionary <string, Dictionary <string, Tuple <CrystariumType, Ability, int> > > plando, string name, DataStoreWDB <DataStoreCrystarium, DataStoreIDCrystarium> crystarium)
 {
     if (Flags.CrystariumFlags.NewAbilities && Flags.CrystariumFlags.NewAbilities.ExtraSelected)
     {
         Flags.CrystariumFlags.NewAbilities.SetRand();
         crystarium.DataList
         .Where(c => c.Type == CrystariumType.Ability &&
                c.CPCost > 0 && (primaryRoles[name].Contains(c.Role) || c.Stage > 1) &&
                !plando[name].Keys.Select(k => crystarium[k]).Contains(c))
         .ToList().Shuffle((a, b) => a.SwapStatsAbilities(b));
         RandomNum.ClearRand();
     }
 }
예제 #25
0
        public void SplitMessage_RandomStringsTest()
        {
            for (var i = 0; i < 10000; i++)
            {
                var randomNum = RandomNum.Next(1, 400);
                var randomStr = GenerateRandomUnicodeString(randomNum);

                var splitted = SmsHelpers.SplitMessageWithWordWrap(randomStr);
                var combined = string.Concat(splitted.Parts.Select(part => part.Content));

                Assert.Equal(combined, randomStr);
            }
        }
예제 #26
0
 /// <summary>
 /// Constructs a random chromosome string of a given length
 /// </summary>
 public Chromosome(int length)
 {
     if (length == 0)
     {
         return;
     }
     Bitstring = new bool[length];
     for (int i = 0; i < length; i++)
     {
         Bitstring[i] = RandomNum.RandomBool();
     }
     hashcode = GetHashCode();
 }
예제 #27
0
파일: Shapes.cs 프로젝트: zsabbasi/Shapes
        public override void Draw()
        {
            using (var bmp = new Bitmap(3000, 3000))
                using (var gr = Graphics.FromImage(bmp))
                {
                    gr.RotateTransform(RandomNum.Next(0, 20));
                    Pen pen = new Pen(Brushes.Black);
                    //Note - we could use gr.DrawRectangle() to render a rectangle!
                    gr.DrawPolygon(pen, this.Vertices);

                    var fileName = $"{this.Name}.png";

                    this.ImageWriter.WriteImage(fileName, bmp);
                }
        }
예제 #28
0
 private static int[] RandomPictures3(int number, CountOfPictures countOf)
 {
     int[] nums = new int[number];
     for (int i = 0; i < number; i++)
     {
         if (countOf == CountOfPictures.Max)
         {
             nums[i] = RandomNum.Next(0, (int)countOf - 1);
         }
         else
         {
             nums[i] = RandomNum.Next(0, (int)countOf);
         }
     }
     return(nums);
 }
예제 #29
0
파일: Shapes.cs 프로젝트: zsabbasi/Shapes
        public override void Draw()
        {
            using (var bmp = new Bitmap(3000, 3000))
            {
                using (var gr = Graphics.FromImage(bmp))
                {
                    gr.RotateTransform(RandomNum.Next(0, 20));
                    Pen pen = new Pen(Brushes.Black);
                    gr.DrawEllipse(pen, new RectangleF(RandomNum.Next(100, 600), RandomNum.Next(150, 650), WidthAndHeight, WidthAndHeight));

                    var fileName = $"{this.Name}.png";

                    this.ImageWriter.WriteImage(fileName, bmp);
                }
            }
        }
예제 #30
0
        public void ShuffleTechniques(Dictionary <string, Dictionary <string, Tuple <CrystariumType, Ability, int> > > plando, string name, DataStoreWDB <DataStoreCrystarium, DataStoreIDCrystarium> crystarium)
        {
            if (Flags.CrystariumFlags.NewAbilities)
            {
                List <string> techniqueIDs = Abilities.abilities.Where(a => a.Role == Role.None).SelectMany(a => a.GetIDs()).ToList();

                Flags.CrystariumFlags.NewAbilities.SetRand();
                crystarium.DataList
                .Where(c => c.Type == CrystariumType.Ability &&
                       techniqueIDs.Contains(c.AbilityName) &&
                       (!Flags.CrystariumFlags.NewAbilities.ExtraSelected2 || (Flags.CrystariumFlags.NewAbilities.ExtraSelected2 && Abilities.GetAbility(name, c) != Abilities.Libra)) &&
                       !plando[name].Keys.Select(k => crystarium[k]).Contains(c))
                .ToList().Shuffle((a, b) => a.SwapStatsAbilities(b));
                RandomNum.ClearRand();
            }
        }