Exemple #1
0
        private async Task <long> HighestSignalSentToTheThrusters(long[] phaseSettings)
        {
            var permutationsTasks = Permutations <long> .AllFor(phaseSettings)
                                    .Select(p => GetOutputFor(p));

            var results = await Task.WhenAll(permutationsTasks);

            return(results.Max());
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string k = textBox1.Text;

            //string[] defarray = textBox1.Lines;
            string[]     list = k.Split();
            string       j;
            FileStream   fs        = new FileStream("./mixer.txt", FileMode.Create);
            StreamWriter file      = new StreamWriter(fs);
            string       appPath   = Application.StartupPath;
            int          numOfWord = list.Count();

            foreach (string[] permutation in Permutations <string> .AllFor(list))
            {
                j = string.Join("", permutation);
                file.WriteLine(j);
                j = null;
            }

            file.Close();
            fs.Close();
        }