Exemplo n.º 1
0
        public Bombe(IEnumerable<MapEntry> mapping, char input, char entry, 
            WheelType[] wheelTypes, ReflectorType reflectorType, bool enableDiagonalBoard)
        {
            this.input = input;
            this.entry = entry;
            Buses = new Dictionary<char, Bus>();
            for (char c = 'A'; c <= 'Z'; c++) Buses.Add(c, new Bus(c));
            if (enableDiagonalBoard)
            {
                diagonalBoard = new DiagonalBoard(Buses);  //yes, hackey....
            }
            Enigmas = new List<BombeEnigma>();

            foreach (var map in mapping)
            {
                var bombeEnigma = new BombeEnigma(wheelTypes, reflectorType, map.StepsAheadOfKey, Buses[map.LeftChar], Buses[map.RightChar]);
                Enigmas.Add(bombeEnigma);
            }
            CurrentKeys = new char[wheelTypes.Length];
        }
Exemplo n.º 2
0
        public Bombe(IEnumerable <MapEntry> mapping, char input, char entry,
                     WheelType[] wheelTypes, ReflectorType reflectorType, bool enableDiagonalBoard)
        {
            this.input = input;
            this.entry = entry;
            Buses      = new Dictionary <char, Bus>();
            for (char c = 'A'; c <= 'Z'; c++)
            {
                Buses.Add(c, new Bus(c));
            }
            if (enableDiagonalBoard)
            {
                diagonalBoard = new DiagonalBoard(Buses);  //yes, hackey....
            }
            Enigmas = new List <BombeEnigma>();

            foreach (var map in mapping)
            {
                var bombeEnigma = new BombeEnigma(wheelTypes, reflectorType, map.StepsAheadOfKey, Buses[map.LeftChar], Buses[map.RightChar]);
                Enigmas.Add(bombeEnigma);
            }
            CurrentKeys = new char[wheelTypes.Length];
        }