public void Day12Part1_TestSolution()
        {
            //            string[] bodies = DayDataUtilities.ReadLinesFromFile("day12.txt");
            //            Assert.NotNull(bodies);
            //< x = 15, y = -2, z = -6 >
            //< x = -5, y = -4, z = -11 >
            //< x = 0, y = -6, z = 0 >
            //< x = 5, y = 9, z = 6 >
            int[,] bodies = new int[4, 3]
            {
                { 15, -2, -6 },
                { -5, -4, -11 },
                { 0, -6, 0 },
                { 5, 9, 6 }
            };
            var sut = new NBodyCalculator(bodies);

            Assert.NotNull(sut.Bodies);
            Assert.Equal(15, sut.Bodies[0, 0]);
            Assert.Equal(-4, sut.Bodies[1, 1]);
            Assert.Equal(0, sut.Bodies[2, 2]);
            Assert.Equal(9, sut.Bodies[3, 1]);
            sut.DumpBodiesAndVelocities();

            for (int step = 1; step <= 1000; step++)
            {
                sut.CalculateVelocity();
                sut.ApplyVelocity();
            }
            sut.DumpBodiesAndVelocities();

            Assert.Equal(6735, sut.CalculateTotalEnergy());
        }
        public void Day12Part1_Example01()
        {
            //< x = -1, y = 0, z = 2 >
            //< x = 2, y = -10, z = -7 >
            //< x = 4, y = -8, z = 8 >
            //< x = 3, y = 5, z = -1 >
            int[,] bodies = new int[4, 3]
            {
                { -1, 0, 2 },
                { 2, -10, -7 },
                { 4, -8, 8 },
                { 3, 5, -1 }
            };
            var sut = new NBodyCalculator(bodies);

            Assert.NotNull(sut.Bodies);
            Assert.Equal(-1, sut.Bodies[0, 0]);
            Assert.Equal(-10, sut.Bodies[1, 1]);
            Assert.Equal(8, sut.Bodies[2, 2]);
            Assert.Equal(5, sut.Bodies[3, 1]);
            sut.DumpBodiesAndVelocities();

            // step 1
            sut.CalculateVelocity();
            sut.ApplyVelocity();
            sut.DumpBodiesAndVelocities();
            Assert.Equal(2, sut.Bodies[0, 0]);
            Assert.Equal(-7, sut.Bodies[1, 1]);
            Assert.Equal(5, sut.Bodies[2, 2]);
            Assert.Equal(2, sut.Bodies[3, 1]);

            for (int step = 2; step <= 10; step++)
            {
                Debug.WriteLine("Step: ", step);
                sut.CalculateVelocity();
                sut.ApplyVelocity();
                sut.DumpBodiesAndVelocities();
            }
            Assert.Equal(2, sut.Bodies[0, 0]);
            Assert.Equal(-8, sut.Bodies[1, 1]);
            Assert.Equal(1, sut.Bodies[2, 2]);
            Assert.Equal(0, sut.Bodies[3, 1]);

            Assert.Equal(179, sut.CalculateTotalEnergy());
        }
        public void Day12Part1_Example02()
        {
            //< x = -8, y = -10, z = 0 >
            //< x = 5, y = 5, z = 10 >
            //< x = 2, y = -7, z = 3 >
            //< x = 9, y = -8, z = -3 >
            int[,] bodies = new int[4, 3]
            {
                { -8, -10, 0 },
                { 5, 5, 10 },
                { 2, -7, 3 },
                { 9, -8, -3 }
            };

            var sut = new NBodyCalculator(bodies);

            Assert.NotNull(sut.Bodies);
            Assert.Equal(-8, sut.Bodies[0, 0]);
            Assert.Equal(5, sut.Bodies[1, 1]);
            Assert.Equal(3, sut.Bodies[2, 2]);
            Assert.Equal(-8, sut.Bodies[3, 1]);
            sut.DumpBodiesAndVelocities();

            for (int step = 1; step <= 100; step++)
            {
                Debug.WriteLine("Step: ", step);
                sut.CalculateVelocity();
                sut.ApplyVelocity();
            }
            sut.DumpBodiesAndVelocities();
            Assert.Equal(8, sut.Bodies[0, 0]);
            Assert.Equal(16, sut.Bodies[1, 1]);
            Assert.Equal(-1, sut.Bodies[2, 2]);
            Assert.Equal(-13, sut.Bodies[3, 1]);

            Assert.Equal(1940, sut.CalculateTotalEnergy());
        }