예제 #1
0
        public void TestGetSurroundingInctiveCubes()
        {
            List <int[]> activeCubes   = CubeSimulator.GetActiveCubes(this.testData);
            List <int[]> inactiveCubes = CubeSimulator.GetSurroundingInactive(activeCubes);

            Assert.AreEqual(61, inactiveCubes.Count);
        }
예제 #2
0
        public void TestGetSurroundingActiveCubes()
        {
            List <int[]> activeCubes = CubeSimulator.GetActiveCubes(this.testData);
            int          noOfActive  = CubeSimulator.GetSurroundingActive(activeCubes[0], activeCubes);

            Assert.AreEqual(1, noOfActive);
        }
예제 #3
0
        public void TestGetActiveInitialStates(int iCube, int[] expectedCoordinates)
        {
            List <int[]> activeCubes = CubeSimulator.GetActiveCubes(this.testData);

            Assert.AreEqual(5, activeCubes.Count);
            Assert.AreEqual(expectedCoordinates, activeCubes[iCube]);
        }
예제 #4
0
        public void Setup()
        {
            var cubesim = new CubeSimulator();

            this.testData  = cubesim.GetInputDataMap(FilePathTestData);
            this.inputData = cubesim.GetInputDataMap(FilePathInputData);
        }
예제 #5
0
 public void TestGetInitialState()
 {
     char[,,] initialState = CubeSimulator.GetInitialState(this.testData);
     Assert.AreEqual(3, initialState.GetLength(0));
     Assert.AreEqual(3, initialState.GetLength(1));
     Assert.AreEqual(3, initialState.GetLength(2));
     Assert.AreEqual('.', initialState[0, 0, 0]);
     Assert.AreEqual('#', initialState[0, 1, 0]);
 }
예제 #6
0
        public void FindAnswerDaySeventeenPuzzleOne()
        {
            List <int[]> activeCubes = CubeSimulator.Simulate(this.inputData, 6);

            Assert.AreEqual(448, activeCubes.Count);
        }
예제 #7
0
        public void TestSimulate(int simulationSteps, int expectedActive)
        {
            List <int[]> activeCubes = CubeSimulator.Simulate(this.testData, simulationSteps);

            Assert.AreEqual(expectedActive, activeCubes.Count);
        }