Ejemplo n.º 1
0
        private static void Day15()
        {
            int time;

            var discs = new Day15.Disc[]
            {
                new Day15.Disc {
                    Positions = 5, Current = 2
                },
                new Day15.Disc {
                    Positions = 13, Current = 7
                },
                new Day15.Disc {
                    Positions = 17, Current = 10
                },
                new Day15.Disc {
                    Positions = 3, Current = 2
                },
                new Day15.Disc {
                    Positions = 19, Current = 9
                },
                new Day15.Disc {
                    Positions = 7, Current = 0
                },
                new Day15.Disc {
                    Positions = 11, Current = 0
                }
            };

            var p = new Day15.Day15(0, discs);

            time = p.FindTimeSlot();

            Console.WriteLine($"Capsule falls through all discs at time {time}");
        }
Ejemplo n.º 2
0
        public void CapsuleFallsThroughDisc()
        {
            var disc = new Disc {
                Positions = 5, Current = 4
            };
            var expected = true;

            var sut = new AdventOfCode2016.Day15.Day15(time: 0, discs: disc);

            var actual = sut.CapsuleFallsThrough();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void CapsuleBouncesOffSecondDisc(int time, bool expected)
        {
            var discs = new Disc[] {
                new Disc {
                    Positions = 5, Current = 4
                },
                new Disc {
                    Positions = 2, Current = 1
                }
            };

            var sut = new AdventOfCode2016.Day15.Day15(time, discs);

            var actual = sut.CapsuleFallsThrough();

            Assert.Equal(expected, actual);
        }