Пример #1
0
        public void TestGenerateAction2()
        {
            // Center case
            int[]         board  = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
            SlidingPuzzle puzzle = new SlidingPuzzle(board);

            SlidingPuzzleAction[] actual   = puzzle.GetActions().ToArray();
            SlidingPuzzleAction[] expected = new SlidingPuzzleAction[2];
            expected[0] = new SlidingPuzzleAction(0, 0 + 1);
            expected[1] = new SlidingPuzzleAction(0, 0 + 3);

            System.Console.WriteLine("Testing GenerateActions()");
            System.Console.WriteLine("\tTop-Left Case");
            Assert.Equal(actual, expected);
        }
Пример #2
0
        public void TestGenerateAction3()
        {
            // Center case
            int[]         board  = { 8, 1, 2, 3, 4, 5, 6, 7, 0 };
            SlidingPuzzle puzzle = new SlidingPuzzle(board);

            SlidingPuzzleAction[] actual   = puzzle.GetActions().ToArray();
            SlidingPuzzleAction[] expected = new SlidingPuzzleAction[2];
            expected[0] = new SlidingPuzzleAction(8, 8 - 1);
            expected[1] = new SlidingPuzzleAction(8, 8 - 3);

            System.Console.WriteLine("Testing GenerateActions()");
            System.Console.WriteLine("\tBottom-Right Case");
            Assert.Equal(actual, expected);
        }
Пример #3
0
        public void TestGenerateAction1()
        {
            // Center case
            int[]         board  = { 1, 2, 3, 4, 0, 5, 6, 7, 8 };
            SlidingPuzzle puzzle = new SlidingPuzzle(board);

            SlidingPuzzleAction[] actual   = puzzle.GetActions().ToArray();
            SlidingPuzzleAction[] expected = new SlidingPuzzleAction[4];
            expected[0] = new SlidingPuzzleAction(4, 4 - 1);
            expected[1] = new SlidingPuzzleAction(4, 4 + 1);
            expected[2] = new SlidingPuzzleAction(4, 4 - 3);
            expected[3] = new SlidingPuzzleAction(4, 4 + 3);

            System.Console.WriteLine("Testing GenerateActions()");
            System.Console.WriteLine("\tCenter Case");
            Assert.Equal(actual, expected);
        }