Beispiel #1
0
        public void TestCanSend()
        {
            int canSend = Context.CanSend(Context.GetPlanet(3));
            Assert.AreEqual(Context.GetPlanet(3).NumShips(), canSend);

            canSend = Context.CanSend(Context.GetPlanet(1));
            Assert.AreEqual(0, canSend);

            PlanetWars planetWars = new PlanetWars(
                "P 1 1 1 30 5#0\n" +
                "P 9 9 1 30 5#1 we need second planet to have Router.MaxDistance > 0\n" +
                "F 2 20 1 0 5 1\n" +
                "F 2 18 1 0 5 2\n" +
                "F 2 3 1 0 5 3\n" +
                "go\n");
            canSend = planetWars.CanSend(planetWars.GetPlanet(0));

            Assert.AreEqual(2, canSend);
        }
Beispiel #2
0
        public void TestCanSendInFuture()
        {
            PlanetWars planetWars = new PlanetWars(
                "P 1 1 1 30 5#0\n" +
                "P 9 9 1 30 5#1 we need second planet to have Router.MaxDistance > 0\n" +
                "F 2 20 1 0 5 1\n" +
                "F 2 18 1 0 5 2\n" +
                "F 2 3 1 0 5 3\n" +
                "go\n");
            int canSend = planetWars.CanSend(planetWars.GetPlanet(0), 3);

            Assert.AreEqual(4, canSend);
        }
Beispiel #3
0
        public void TestCanSendShipNumber()
        {
            PlanetWars planetWars = new PlanetWars(
                "P 11.613591 11.658737 0 119 0#0\n" +
                "P 1.2902863 9.040786 1 20 5#1\n" +
                "P 21.936895 14.276689 1 72 5#2\n" +
                "P 5.648358 18.265993 1 150 4#3\n" +
                "P 17.578823 5.051482 0 21 4#4\n" +
                "P 0 17.566463 1 2 2#5\n" +
                "P 23.227182 5.751012 0 32 2#6\n" +
                "P 15.9964075 22.492537 0 60 5#7\n" +
                "P 7.2307744 0.8249375 1 5 5#8\n" +
                "P 12.096861 23.317474 0 74 5#9\n" +
                "P 11.130321 0 1 6 5#10\n" +
                "P 5.9057293 2.4822736 0 85 1#11\n" +
                "P 17.321453 20.835201 0 85 1#12\n" +
                "P 18.286013 0.76577765 0 72 3#13\n" +
                "P 4.9411683 22.551697 0 72 3#14\n" +
                "P 20.10671 18.059385 2 5 5#15\n" +
                "P 3.120471 5.2580895 1 10 5#16\n" +
                "P 4.5948386 13.786 0 69 2#17\n" +
                "P 18.632343 9.531475 0 69 2#18\n" +
                "P 8.801192 20.015703 0 41 1#19\n" +
                "P 14.425989 3.3017714 0 41 1#20\n" +
                "P 19.466787 20.056168 1 39 5#21\n" +
                "P 3.7603943 3.2613065 1 5 5#22\n" +
                "F 1 10 8 3 18 1\n" +
                "F 1 10 8 3 18 2\n" +
                "F 1 5 8 3 18 3\n" +
                "F 1 9 3 15 15 1\n" +
                "F 1 5 8 3 18 4\n" +
                "F 1 10 3 15 15 2\n" +
                "F 1 20 8 3 18 5\n" +
                "F 1 11 3 15 15 3\n" +
                "F 1 20 8 3 18 6\n" +
                "F 1 11 3 15 15 4\n" +
                "F 1 11 3 15 15 5\n" +
                "F 1 57 8 4 12 3\n" +
                "F 1 5 1 3 11 4\n" +
                "F 1 5 1 3 11 5\n" +
                "F 1 5 1 3 11 6\n" +
                "F 1 2 5 3 6 1\n" +
                "F 1 15 16 1 5 1\n" +
                "F 1 5 1 3 11 7\n" +
                "F 1 2 5 3 6 2\n" +
                "F 1 2 5 3 6 3\n" +
                "F 1 15 16 1 5 2\n" +
                "F 1 5 1 3 11 8\n" +
                "F 1 20 1 3 11 9\n" +
                "F 1 2 5 3 6 4\n" +
                "F 1 10 16 1 5 3\n" +
                "F 1 5 22 16 3 1\n" +
                "F 2 54 15 2 5 4\n" +
                "F 1 5 22 16 3 2\n" +
                "F 1 10 16 1 5 4\n" +
                "F 1 2 5 3 6 5\n" +
                "F 1 20 1 3 11 10\n" +
                "F 1 88 8 10 4 3\n" +
                "go\n");
            int canSend = planetWars.CanSend(planetWars.GetPlanet(2));

            Assert.AreEqual(92-54, canSend);
        }