示例#1
0
        public SeaPortComputer(IWriteDecoder writeDecoder)
        {
            if (writeDecoder == null)
            {
                throw new ArgumentNullException(nameof(IWriteDecoder));
            }

            _writeDecoder = writeDecoder;
        }
        private ulong RunProgramAndSumMemoryContents(IWriteDecoder writeDecoder)
        {
            var seaPortComputer = new SeaPortComputer(writeDecoder);

            foreach (var instruction in _instructions)
            {
                seaPortComputer.ExecuteInstruction(instruction);
            }

            return(seaPortComputer.Memory.Aggregate(0UL, (a, x) => a + x.Item2));
        }