コード例 #1
0
        private static IEnumerable <Tile> AddWriters(IEnumerable <string> binaryStrings, int stoppingValue)
        {
            var results = new List <Tile>();

            var encodedDigits = binaryStrings.ToList();

            foreach (var signal in new[] { Signals.Carry, Signals.NoCarry })
            {
                foreach (var binaryString in encodedDigits)
                {
                    var writer = new Writer(binaryString, signal, stoppingValue);

                    results.AddRange(writer.Tiles());
                }
            }

            foreach (var signal in new[] { Signals.First, Signals.Nth })
            {
                for (var i = 0; i < encodedDigits.Count; i++)
                {
                    var binaryString = encodedDigits[i];

                    var copier = new Copier(binaryString, signal);

                    var tiles = copier.Tiles().ToList();

                    results.AddRange(tiles);
                    var incrementStopper = new IncrementStopper(binaryString, signal);
                    results.AddRange(incrementStopper.Tiles());
                }
            }

            return(results);
        }