public static bool ApplyATransformation(SevenChord chordo, int[] transformation, int transpose = 0)
        {
            chordo.ChordType = SevenChord.DetermineChordType(chordo);
            var mode = SevenChordTypes.SevenChordModeFormula[chordo.Mode];

            chordo.ChordNotes[0] = JustNote.moveNoteBySemitones(chordo.ChordNotes[0], transformation[0] + transpose);
            chordo.ChordNotes[1] = JustNote.moveNoteBySemitones(chordo.ChordNotes[1], transformation[1] + transpose);
            chordo.ChordNotes[2] = JustNote.moveNoteBySemitones(chordo.ChordNotes[2], transformation[2] + transpose);
            chordo.ChordNotes[3] = JustNote.moveNoteBySemitones(chordo.ChordNotes[3], transformation[3] + transpose);

            chordo.ChordType = SevenChord.DetermineChordType(chordo);
            if (chordo.ChordType == "undefined")
            {
                return(false);
            }

            try
            {
                SevenChord.ResetChordRootStepsModeAndInversion(chordo);
                if (chordo.ChordNotes.All(cn => cn.unboundOctave > 19 || cn.unboundOctave < -10))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            } catch (Exception) { return(false); }
        }
        public static int[] GetATransformation(SevenChord chord1, SevenChord chord2)
        {
            var notes1 = chord1.ChordNotes.OrderBy(n => n.getNoteNumber()).ToArray();
            var notes2 = chord2.ChordNotes.OrderBy(n => n.getNoteNumber()).ToArray();

            var aTransformation  = new int[4];
            var aTransformation2 = new int[4];

            for (int i = 0; i < 4; i++)
            {
                aTransformation2[i] = notes2[i].getNoteNumber() - notes1[i].getNoteNumber();
            }

            var indexes = new int[4] {
                0, 0, 0, 0
            };

            for (int i = 0; i < 4; i++)
            {
                int ind2 = 0;
                while (chord1.ChordNotes[i] != notes1[ind2])
                {
                    ind2++;
                    indexes[i]++;
                }
            }

            aTransformation[0] = aTransformation2[indexes[0]];
            aTransformation[1] = aTransformation2[indexes[1]];
            aTransformation[2] = aTransformation2[indexes[2]];
            aTransformation[3] = aTransformation2[indexes[3]];

            if (aTransformation[0] > 0)
            {
                while (aTransformation[0] > 0)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        aTransformation[i] -= 1;
                    }
                }
            }
            else if (aTransformation[0] < 0)
            {
                while (aTransformation[0] < 0)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        aTransformation[i] += 1;
                    }
                }
            }

            return(aTransformation);
        }
Esempio n. 3
0
        static public string DetermineChordType(SevenChord chordo)
        {
            var f         = new int[4];
            var neuChordo = new SevenChord(chordo.ChordNotes[0], chordo.ChordNotes[1], chordo.ChordNotes[2], chordo.ChordNotes[3], chordo.Mode, chordo.Inversion);

            int size = neuChordo.GetChordSize();

            var notes = neuChordo.ChordNotes.OrderBy(n => n.getNoteNumber()).ToArray();

            while (size > 12)
            {
                notes = notes.OrderBy(n => n.getNoteNumber()).ToArray();

                notes[0] = JustNote.moveNoteBySemitones(notes[0], 12);

                notes = notes.OrderBy(n => n.getNoteNumber()).ToArray();
                size  = notes.Last().getNoteNumber() - notes.First().getNoteNumber();
                if (size > 12)
                {
                    notes[3] = JustNote.moveNoteBySemitones(notes[3], -12);
                    notes    = notes.OrderBy(n => n.getNoteNumber()).ToArray();

                    size = notes.Last().getNoteNumber() - notes.First().getNoteNumber();
                }
            }

            f[0] = notes[1].getNoteNumber() - notes[0].getNoteNumber();
            f[1] = notes[2].getNoteNumber() - notes[1].getNoteNumber();
            f[2] = notes[3].getNoteNumber() - notes[2].getNoteNumber();
            f[3] = 12 - f[0] - f[1] - f[2];

            var fTemp = new int[4];

            for (int i = 0; i < 4; i++)
            {
                fTemp[0] = f[(i + 0) % 4];
                fTemp[1] = f[(i + 1) % 4];
                fTemp[2] = f[(i + 2) % 4];
                fTemp[3] = f[(i + 3) % 4];

                if (SevenChordTypes.SevenchordTypes.Select(fff => fff.Value).Any(fo => fo[0] == fTemp[0] && fo[1] == fTemp[1] && fo[2] == fTemp[2] && fo[3] == fTemp[3]))
                {
                    neuChordo.ChordType = SevenChordTypes.SevenchordTypes.First(fo => fo.Value[0] == fTemp[0] && fo.Value[1] == fTemp[1] && fo.Value[2] == fTemp[2] && fo.Value[3] == fTemp[3]).Key.ToString();
                    break;
                }

                if (i == 3)
                {
                    neuChordo.ChordType = "undefined";
                }
            }
            return(neuChordo.ChordType);
        }
Esempio n. 4
0
        // TODO : There will be placed all logic to create data from scratch.
        // It will not be used often 'cause data is static and will be stored in DB
        public static List <SevenChord> GetAllPossibleSevenChords()
        {
            var listo = new List <SevenChord>();

            foreach (var item in SevenChordTypes.SevenchordTypes)
            {
                for (int m = 0; m < 6; m++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        var chordo = new SevenChord(JustNote.getNoteFromNumber(36), item.Value);
                        chordo.Mode = (SevenChordMode)m;
                        chordo.InverseForward((SevenChordInversion)i);
                        listo.Add(chordo);
                    }
                }
            }
            return(listo);
        }
Esempio n. 5
0
        static public void ResetChordRootStepsModeAndInversion(SevenChord chordo)
        {
            for (int n = 0; n < 4; n++)
            {
                for (int m = 0; m < 6; m++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        var neuChord = new SevenChord(chordo.ChordNotes[n], GetChordFormula(chordo.ChordType), (SevenChordMode)m, (SevenChordInversion)i);

                        var notesNeu  = neuChord.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();
                        var notesOrig = chordo.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();

                        if (
                            notesNeu[0] == notesOrig[0] &&
                            notesNeu[1] == notesOrig[1] &&
                            notesNeu[2] == notesOrig[2] &&
                            notesNeu[3] == notesOrig[3]
                            )
                        {
                            JustNote[] notes = new JustNote[4];
                            notes[0] = chordo.ChordNotes[0];
                            notes[1] = chordo.ChordNotes[1];
                            notes[2] = chordo.ChordNotes[2];
                            notes[3] = chordo.ChordNotes[3];

                            chordo.ChordNotes[0] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[0].nameOfTheNote).First();
                            chordo.ChordNotes[1] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[1].nameOfTheNote).First();
                            chordo.ChordNotes[2] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[2].nameOfTheNote).First();
                            chordo.ChordNotes[3] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[3].nameOfTheNote).First();


                            chordo.Mode      = neuChord.Mode;
                            chordo.Inversion = neuChord.Inversion;
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public static List <SevenChordTransformationWithData> CalculateTransDataForSevenChords(List <int[]> sChordsTransformations)
        {
            var TransData = new List <SevenChordTransformationWithData>();

            int counttt = 0;

            foreach (var item in sChordsTransformations)
            {
                var a = new SevenChordTransformationWithData();
                a.Formula = item;
                a.ApplicationsOnVariosChords = new List <SevenChordTransformationDetailedInfo>();

                foreach (var chordtype in SevenChordTypes.SevenchordTypes.Keys)
                {
                    foreach (SevenChordMode mode in (SevenChordMode[])Enum.GetValues(typeof(SevenChordMode)))
                    {
                        foreach (SevenChordInversion inv in (SevenChordInversion[])Enum.GetValues(typeof(SevenChordInversion)))
                        {
                            var b = new SevenChordTransformationDetailedInfo();

                            b.InitialChordType      = chordtype;
                            b.InitialChordMode      = mode;
                            b.InitialChordInversion = inv;

                            var testChord = new SevenChord(JustNote.getNoteFromNumber(48), SevenChordTypes.GetChordFormula(chordtype), mode, inv);

                            b.TheApplications     = new List <SevenChordSignature>();
                            b.TheStepsTransitions = new List <ChordStepsTransition>();

                            var bb = new SevenChordSignature();
                            bb.ChordType = testChord.ChordType;
                            bb.Mode      = testChord.Mode;
                            bb.Inversion = testChord.Inversion;
                            b.TheApplications.Add(bb);

                            var prevNotes = new JustNote[4];
                            for (int i = 0; i < 4; i++)
                            {
                                prevNotes[i] = testChord.ChordNotes[i];
                            }

                            var prevSize = testChord.GetChordSize();
                            var origSize = testChord.GetChordSize();

                            int simpleLoopFound = 0;
                            int fullLoopFound   = 0;

                            int stepsTaken = 0;
                            while (SevenChordTransformation.ApplyATransformation(testChord, a.Formula) && !b.Cyclic)
                            {
                                var bbb = new SevenChordSignature();
                                bbb.ChordType = testChord.ChordType;
                                bbb.Mode      = testChord.Mode;
                                bbb.Inversion = testChord.Inversion;
                                b.TheApplications.Add(bbb);

                                var bbc = new ChordStepsTransition();
                                bbc.TonicMoved   = testChord.ChordNotes[0].getNoteNumber() - prevNotes[0].getNoteNumber();
                                bbc.ThirdMoved   = testChord.ChordNotes[1].getNoteNumber() - prevNotes[1].getNoteNumber();
                                bbc.FifthMoved   = testChord.ChordNotes[2].getNoteNumber() - prevNotes[2].getNoteNumber();
                                bbc.SeventhMoved = testChord.ChordNotes[3].getNoteNumber() - prevNotes[3].getNoteNumber();

                                for (int i = 0; i < 4; i++)
                                {
                                    prevNotes[i] = JustNote.moveNoteBySemitones(prevNotes[i], a.Formula[i]);
                                }

                                if (prevNotes[0].getNoteNumber() == testChord.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.TonicInto = SevenChordStep.T;
                                }
                                else if (prevNotes[0].getNoteNumber() == testChord.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.TonicInto = SevenChordStep.III;
                                }
                                else if (prevNotes[0].getNoteNumber() == testChord.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.TonicInto = SevenChordStep.V;
                                }
                                else if (prevNotes[0].getNoteNumber() == testChord.ChordNotes[3].getNoteNumber())
                                {
                                    bbc.TonicInto = SevenChordStep.VII;
                                }

                                if (prevNotes[1].getNoteNumber() == testChord.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.ThirdInto = SevenChordStep.T;
                                }
                                else if (prevNotes[1].getNoteNumber() == testChord.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.ThirdInto = SevenChordStep.III;
                                }
                                else if (prevNotes[1].getNoteNumber() == testChord.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.ThirdInto = SevenChordStep.V;
                                }
                                else if (prevNotes[1].getNoteNumber() == testChord.ChordNotes[3].getNoteNumber())
                                {
                                    bbc.ThirdInto = SevenChordStep.VII;
                                }

                                if (prevNotes[2].getNoteNumber() == testChord.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.FifthInto = SevenChordStep.T;
                                }
                                else if (prevNotes[2].getNoteNumber() == testChord.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.FifthInto = SevenChordStep.III;
                                }
                                else if (prevNotes[2].getNoteNumber() == testChord.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.FifthInto = SevenChordStep.V;
                                }
                                else if (prevNotes[2].getNoteNumber() == testChord.ChordNotes[3].getNoteNumber())
                                {
                                    bbc.FifthInto = SevenChordStep.VII;
                                }

                                if (prevNotes[3].getNoteNumber() == testChord.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.SeventhInto = SevenChordStep.T;
                                }
                                else if (prevNotes[3].getNoteNumber() == testChord.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.SeventhInto = SevenChordStep.III;
                                }
                                else if (prevNotes[3].getNoteNumber() == testChord.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.SeventhInto = SevenChordStep.V;
                                }
                                else if (prevNotes[3].getNoteNumber() == testChord.ChordNotes[3].getNoteNumber())
                                {
                                    bbc.SeventhInto = SevenChordStep.VII;
                                }

                                bbc.SizeDifference = testChord.GetChordSize() - prevSize;
                                prevSize           = testChord.GetChordSize();

                                b.TheStepsTransitions.Add(bbc);

                                for (int i = 0; i < 4; i++)
                                {
                                    prevNotes[i] = testChord.ChordNotes[i];
                                }

                                stepsTaken++;

                                // TODO : More complicated and trusted way to determine exact cycle
                                if (testChord.ChordType == chordtype)
                                {
                                    simpleLoopFound++;
                                }
                                if (testChord.ChordType == chordtype && testChord.Mode == mode && testChord.Inversion == inv)
                                {
                                    fullLoopFound++;
                                }
                                if (fullLoopFound == 2)
                                {
                                    b.Cyclic = true;
                                }

                                if (stepsTaken > 27 && simpleLoopFound < 1)
                                {
                                    break;
                                }
                                if (stepsTaken > 55)
                                {
                                    break;
                                }
                            }


                            if (b.Cyclic)
                            {
                                b.LoopByTypeDistance = (stepsTaken / 2 + 1) / (simpleLoopFound / 2) - 1;
                                b.FullLoopDistance   = stepsTaken / 2;

                                var sum = b.TheStepsTransitions.Sum(st => st.TonicMoved);
                                if (sum == 0)
                                {
                                    b.StayInPlace = true;
                                }
                                else if (sum > 0)
                                {
                                    b.MovingUp = true;
                                }
                                else
                                {
                                    b.MovingDown = true;
                                }

                                b.TheApplications.RemoveRange(b.FullLoopDistance, b.TheApplications.Count - b.FullLoopDistance - 1);
                                b.TheStepsTransitions.RemoveRange((b.FullLoopDistance - 1), b.TheStepsTransitions.Count - b.FullLoopDistance);

                                if (origSize - prevSize == 0)
                                {
                                    b.SizeKept = true;
                                }

                                a.ApplicationsOnVariosChords.Add(b);
                            }
                        }
                    }
                }
                if (a.ApplicationsOnVariosChords.Count > 0)
                {
                    TransData.Add(a);
                }
                counttt++;
                Console.WriteLine(TransData.Count + " :: " + counttt + " :: " + " [" + a.Formula[0] + "  " + a.Formula[1] + "  " + a.Formula[2] + "  " + a.Formula[3] + "] " + a.ApplicationsOnVariosChords.Count);
            }
            return(TransData);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            Utils.FairRandom = new Random();

            // Neeeded 'cause of symbols used to name chords
            // Without it works fine, but prints '?' all around
            Console.OutputEncoding = System.Text.Encoding.UTF8;


            /* TRIADS TESTING */
            var triads      = CalculateAllTransformations.GetAllPossibleTriads();
            int countTriads = triads.Count;

            var TriadsTransformations = CalculateAllTransformations.GetRawListOfAcceptableTransormations(triads);

            int initialTriadsTransormationsFound = TriadsTransformations.Count;

            TriadsTransformations = CalculateAllTransformations.SortAndDistintTheTransformations(TriadsTransformations);

            Console.WriteLine("\nTriads transformations ::: " + initialTriadsTransormationsFound + " -> " + TriadsTransformations.Count);

            triads.Sort(delegate(Triad tr1, Triad tr2) { return(tr1.GetChordSize().CompareTo(tr2.GetChordSize())); });

            Console.WriteLine();
            Console.WriteLine("Total triads variations count is: " + countTriads);
            Console.WriteLine();


            var TriadsTransData = CalculateAllTransformations.CalculateTransDataForTriads(TriadsTransformations);

            int triadsMaxDistance = 0;

            triadsMaxDistance = TriadsTransData.Max(t => t.ApplicationsOnVariosTriads.Max(tt => tt.FullLoopDistance));


            var stopme = 1;

            NFugueUsage.playsomeTriads(TriadsTransData, 5);


            stopme = 1;


            /* SEVEN CHORDS TESTING */
            var neg          = CalculateAllTransformations.GetAllPossibleSevenChords();
            int countChordos = neg.Count;

            var Transformations = CalculateAllTransformations.GetRawListOfAcceptableTransormations(neg);

            int initialTransormationsFound = Transformations.Count;

            Transformations = CalculateAllTransformations.SortAndDistintTheTransformations(Transformations);

            Console.WriteLine("\nSevenChords transformations ::: " + initialTransormationsFound + " -> " + Transformations.Count);


            neg.Sort(delegate(SevenChord ch1, SevenChord ch22) { return(ch1.GetChordSize().CompareTo(ch22.GetChordSize())); });

            Console.WriteLine();
            Console.WriteLine("Total chords variations count is: " + countChordos);
            Console.WriteLine();



            int counttt   = 0;
            var TransData = CalculateAllTransformations.CalculateTransDataForSevenChords(Transformations);
            // TODO: Inspect transformations on different chords for being equal

            int kk = 0;

            kk = TransData.Max(t => t.ApplicationsOnVariosChords.Max(tt => tt.FullLoopDistance));

            int kasdf = 0;


            kasdf = 1;
            var rand = new Random();

            //var goodone = TransData[rand.Next(TransData.Count)];
            //foreach (var item in goodone.ApplicationsOnVariosChords)
            //{

            //    //var testChord = new SevenChord(JustNote.getNoteFromNumber(48),
            //    //    SevenChordTypes.GetChordFormula(item.InitialChordType),
            //    //    item.InitialChordMode, item.InitialChordInversion);

            //    for (int i = 0; i < item.FullLoopDistance; i++)
            //    {

            //       // Console.WriteLine("After :: " + " [" + goodone.Formula[0] + "  " + goodone.Formula[1] + "  " + goodone.Formula[2] + "  " + goodone.Formula[3] + "] ");
            //       // Console.WriteLine(testChord.ToString());

            //        //using (var player = new Player())
            //        //{
            //        //    Pattern p1 = new Pattern($"T140 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}w ");
            //        //    Pattern p2 = new Pattern($"T140 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}w ");
            //        //    Pattern p3 = new Pattern($"T140 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}w ");
            //        //    Pattern p4 = new Pattern($"T140 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}w ");

            //        //    //player.Play(p1, p2, p3, p4);
            //        //}
            //        int k1111 = 0;
            //        //SevenChordTransformation.ApplyATransformation(testChord, goodone.Formula);
            //    }
            //}


            playsmthn();
            for (int i = 0; i < 5; i++)
            {
                playsmthn();
            }

            kasdf = 1;

            void playsmthn()
            {
                var goodone = TransData[rand.Next(TransData.Count)];

                var interestings = goodone.ApplicationsOnVariosChords; //.Where(tt => tt.StayInPlace == true).ToList();

                if (interestings.Count() == 0)
                {
                    return;
                }

                var item = interestings[rand.Next(interestings.Count)];

                var testChord = new SevenChord(JustNote.getNoteFromNumber(48),
                                               SevenChordTypes.GetChordFormula(item.InitialChordType),
                                               item.InitialChordMode, item.InitialChordInversion);

                using (var player = new Player())
                {
                    Pattern p1 = new Pattern($"T100 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}q ");
                    Pattern p2 = new Pattern($"T100 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}q ");
                    Pattern p3 = new Pattern($"T100 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}q ");
                    Pattern p4 = new Pattern($"T100 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}q ");

                    player.Play(p1, p2, p3, p4);
                }

                for (int i = 0; i < item.FullLoopDistance * 2; i++)
                {
                    Console.WriteLine("After :: " + " [" + goodone.Formula[0] + "  " + goodone.Formula[1] + "  " + goodone.Formula[2] + "  " + goodone.Formula[3] + "] ");
                    Console.WriteLine(testChord.ToString());

                    using (var player = new Player())
                    {
                        Pattern p1     = new Pattern($"T140 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}w ");
                        Pattern p2     = new Pattern($"T140 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}w ");
                        Pattern p3     = new Pattern($"T140 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}w ");
                        Pattern p4     = new Pattern($"T140 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}w ");
                        int     k21111 = 0;
                        player.Play(p1, p2, p3, p4);
                    }
                    int k1111 = 0;
                    SevenChordTransformation.ApplyATransformation(testChord, goodone.Formula);
                }
            }

            //foreach (var chordtype in SevenChordTypes.SevenchordTypes.Keys)
            //{
            //    var infos = new List<SimpleTransformationInfo>();
            //    foreach (var item in Transformations)
            //    {
            //        var testChord = new SevenChord(JustNote.getNoteFromNumber(48), SevenChordTypes.GetChordFormula(chordtype));

            //        var typeOfChord = testChord.ChordType;
            //        var typeOfChord2 = testChord.ChordType;

            //        var modeOfChord = testChord.Mode;
            //        var modeOfChord2 = testChord.Mode;

            //        var invOfChord = testChord.Inversion;
            //        var invOfChord2 = testChord.Inversion;


            //        int typeRepTwice = 0;
            //        int cycleCount = 0;
            //        if (item[0] == 0 && item[1] == 0 && item[2] == 0 && item[3] == -2)
            //        {
            //            // Console.WriteLine(testChord);
            //            // Console.WriteLine(SevenChord.DetermineChordType(testChord));
            //        }

            //        while (SevenChordTransformation.ApplyATransformation(testChord, new int[] { item[0], item[1], item[2], item[3] }))
            //        {
            //            typeOfChord2 = testChord.ChordType;
            //            modeOfChord2 = testChord.Mode;
            //            invOfChord2 = testChord.Inversion;


            //            if (typeOfChord2 == typeOfChord && modeOfChord2 == modeOfChord && invOfChord2 == invOfChord) typeRepTwice++;
            //            if (typeRepTwice == 2)
            //                break;

            //            if (item[0] == 0 && item[1] == 0 && item[2] == 0 && item[3] == -2)
            //            {
            //                // Console.WriteLine(testChord);
            //                // Console.WriteLine(SevenChord.DetermineChordType(testChord));
            //            }
            //            // Console.WriteLine(ch3);
            //            //Console.WriteLine(SevenChord.DetermineChordType(ch3));
            //            cycleCount++;

            //            if (cycleCount > 100)
            //                break;
            //        }

            //        if (typeRepTwice == 2)
            //        {
            //            var ku = new SimpleTransformationInfo();
            //            ku.count = cycleCount / 2 + 1;
            //            ku.mess = "The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] looped on " + (cycleCount / 2 + 1) + " turn.";

            //            infos.Add(ku);
            //            //Console.WriteLine("The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] looped on " + (cycleCount / 2 + 1) + " turn.");
            //        }
            //        else
            //        {
            //            //    if (cycleCount < 10 && cycleCount > 0)
            //            //        Console.WriteLine("The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] crashed on " + cycleCount + " turn.");
            //        }
            //    }
            //    infos.Sort(delegate (SimpleTransformationInfo ti1, SimpleTransformationInfo ti2) { return ti1.count.CompareTo(ti2.count); });

            //    var ninfos = infos.GroupBy(iii => iii.count).ToList();
            //    Console.WriteLine(chordtype + " loops by steps: ");
            //    ninfos.ForEach(niii => Console.WriteLine(niii.Key + ": " + niii.Count()));
            //}

            Console.Read();
        }