Ejemplo n.º 1
0
        public static Wiring Random(bool useInterval = false)
        {
            Wiring result = new Wiring();

            if (!useInterval)
            {
                result.Plate1 = RandomUtil.GenerateRotor();
                result.Plate2 = RandomUtil.GenerateRotor();

                for (int i = 0; i < 16; i++)
                {
                    result.Rotors.Add(RandomUtil.GenerateRotor());
                    result.Notches.Add(RandomUtil.GenerateNotchRing());
                }
            }
            else
            {
                IntervalWiring iw     = new IntervalWiring();
                var            rotors = iw.ComputeRotorSet(18);

                result.Plate1 = rotors[0].ToString();
                result.Plate2 = rotors[1].ToString();

                for (int i = 0; i < 16; i++)
                {
                    result.Rotors.Add(rotors[i + 2].ToString());
                    result.Notches.Add(RandomUtil.GenerateNotchRing());
                }
            }

            result.Moves.AddRange(RandomUtil.GetRandomMoves());

            return(result);
        }