Exemplo n.º 1
0
        public void ForcedMovesTest()
        {
            var target = new Competitor(30, 10, 'c');

            var results = new List <Move>();

            var debugx = target.DumpMap();

            results.Add(target.MakeMove(new[] {
                new char[] { 'X', 'X', 'X', 'X', 'X' },
                new char[] { 'X', '-', '-', '-', '-' },
                new char[] { 'X', '-', 'J', '-', '-' },
                new char[] { 'X', '-', '-', '-', 'X' },
                new char[] { 'X', 'X', 'X', 'X', 'M' },
            }));
            debugx = target.DumpMap();

            results.Add(target.MakeMove(new[] {
                new char[] { 'X', 'X', 'X', '-', 'X' },
                new char[] { 'X', '-', 'X', '-', 'X' },
                new char[] { 'X', 'X', 'J', '-', 'X' },
                new char[] { 'X', 'X', '-', '-', 'X' },
                new char[] { 'X', 'X', '-', '-', 'M' },
            }));
            debugx = target.DumpMap();

            results.Add(target.MakeMove(new[] {
                new char[] { 'X', 'X', 'X', '-', 'X' },
                new char[] { '-', '-', 'X', '-', 'X' },
                new char[] { '-', '-', 'J', '-', 'X' },
                new char[] { '-', '-', '-', '-', 'X' },
                new char[] { 'X', 'X', 'M', '-', 'M' },
            }));
            debugx = target.DumpMap();

            results.Add(target.MakeMove(new[] {
                new char[] { 'X', 'X', '-', '-', 'X' },
                new char[] { '-', '-', '-', '-', 'X' },
                new char[] { 'X', 'X', 'J', '-', 'X' },
                new char[] { '-', '-', '-', '-', 'X' },
                new char[] { 'X', 'X', 'M', '-', 'M' },
            }));
            debugx = target.DumpMap();

            Assert.Equal(results[0].DirectionEnum, Direction.East);
            Assert.Equal(results[1].DirectionEnum, Direction.South);
            Assert.Equal(results[2].DirectionEnum, Direction.West);
            Assert.Equal(results[3].DirectionEnum, Direction.North);
        }
Exemplo n.º 2
0
        public void UpdatesMapAfterTurnCorrectly()
        {
            var target = new Competitor(10, 20, 'c');

            char[][] input = new [] {
                new char[] { 'X', 'X', 'X', '-', 'X' },
                new char[] { '-', '-', 'X', '-', 'X' },
                new char[] { 'X', 'X', 'J', '-', 'X' },
                new char[] { '-', '-', '-', '-', 'X' },
                new char[] { 'X', 'X', 'M', '-', 'M' },
            };

            var debugx = target.DumpMap();

            var result = target.MakeMove(input);

            Assert.Equal(target.DiscoveredMap[8, 18], MapObjects.Wall);
            Assert.Equal(target.DiscoveredMap[9, 18], MapObjects.FreeSquare);
            Assert.Equal(target.DiscoveredMap[10, 18], MapObjects.Wall);

            Assert.Equal(target.DiscoveredMap[8, 19], MapObjects.Wall);
            Assert.Equal(target.DiscoveredMap[8, 20], MapObjects.Wall);
            Assert.Equal(target.DiscoveredMap[8, 21], MapObjects.FreeSquare);
            Assert.Equal(target.DiscoveredMap[8, 22], MapObjects.Wall);
        }
Exemplo n.º 3
0
        public void SpecificTest()
        {
            var target = new Competitor(30, 30, 'c');

            var results = new List <Move>();

            var debugx = target.DumpMap();

            results.Add(target.MakeMove(new[] {
                new char[] { '-', '-', '-', '-', '-' },
                new char[] { '-', '-', '-', '-', '-' },
                new char[] { 'j', 'j', 'J', '-', '-' },
                new char[] { '-', '-', '-', '-', '-' },
                new char[] { '-', '-', '-', '-', '-' },
            }));
            debugx = target.DumpMap();
        }