public void _05_Processor_Calculates_Transitions_Correclty()
        {
            var map = new SlidingPuzzleMap(
                "1111;" +
                "10W1;" +
                "101;" +
                "101;" +
                "111");
            var processor = new SlidingPuzzleProcessor(map);
            var initState = new SlidingPuzzleState(new Vector2Int(1, 3));

            var result = processor.ProcessWithTransitions(initState, new Vector2Int(0, -1));

            Assert.That(result.Transitions.Length, Is.EqualTo(1), $"Transitions Size Incorrect");
            Assert.That(result.Transitions[0],
                        Is.EqualTo(new Transition(initState.PlayerCoords, new Vector2Int(1, 1))),
                        $"Transition list is incorrect");
        }
        public void _04_Processor_Move_Correctly_Resolved(int[] start, int[] dir, int[] expected, bool expectedWin)
        {
            var map = new SlidingPuzzleMap(
                "1111;" +
                "1001;" +
                "1011;" +
                "1W1;" +
                "111");
            var processor = new SlidingPuzzleProcessor(map);
            var initState = new SlidingPuzzleState(new Vector2Int(start[0], start[1]));

            var result = processor.Process(initState, new Vector2Int(dir[0], dir[1]));

            Assert.That(result.PlayerCoords, Is.EqualTo(new Vector2Int(expected[0], expected[1])), "Player is in incorrect position");
            if (expectedWin)
            {
                Assert.That(result.Type, Is.EqualTo(SlidingPuzzleState.StateType.Win), "Move is not registered as winning");
            }
            else
            {
                Assert.That(result.Type, Is.EqualTo(SlidingPuzzleState.StateType.Idle), "Move is registered as winning");
            }
        }
예제 #3
0
 public Result(SlidingPuzzleState state, Transition[] transitions)
 {
     State       = state;
     Transitions = transitions;
 }