Ejemplo n.º 1
0
        public void TestParseManyFleets()
        {
            #region
            PlanetWars pw = new PlanetWars(
                "P 0 0 2 15 4#0\n" +
                "F 2 29 12 17 14 1\n" +
                "F 1 5 9 15 13 1\n" +
                "F 2 4 8 17 13 1\n" +
                "F 1 5 9 15 13 2\n" +
                "F 1 5 9 15 13 3\n" +
                "F 1 5 9 15 13 4\n" +
                "F 1 5 9 15 13 5\n" +
                "F 1 9 1 15 8 1\n" +
                "F 1 5 9 15 13 6\n" +
                "F 2 2 3 12 8 1\n" +
                "F 2 2 3 12 8 2\n" +
                "F 1 9 1 15 8 2\n" +
                "F 1 5 9 15 13 7\n" +
                "F 1 4 6 1 6 1\n" +
                "F 1 9 1 15 8 3\n" +
                "F 1 5 9 15 13 8\n" +
                "F 2 9 16 12 6 1\n" +
                "F 2 4 5 16 6 1\n" +
                "F 2 5 2 8 6 1\n" +
                "F 2 2 3 12 8 3\n" +
                "F 1 4 6 1 6 2\n" +
                "F 1 9 1 15 8 4\n" +
                "F 1 5 9 15 13 9\n" +
                "F 2 5 10 8 6 2\n" +
                "F 2 9 16 12 6 2\n" +
                "F 2 4 5 16 6 2\n" +
                "F 2 5 2 8 6 2\n" +
                "F 2 2 3 12 8 4\n" +
                "F 2 5 10 8 6 3\n" +
                "F 2 48 12 19 4 1\n" +
                "F 2 9 16 19 4 1\n" +
                "F 2 92 8 19 7 4\n" +
                "F 2 5 2 8 6 3\n" +
                "F 2 2 3 19 6 3\n" +
                "F 2 4 5 16 6 3\n" +
                "F 1 4 6 1 6 3\n" +
                "F 1 5 9 1 7 4\n" +
                "F 1 9 1 15 8 5\n" +
                "F 1 25 4 13 6 4\n" +
                "F 1 4 6 15 6 4\n" +
                "F 1 6 1 6 6 4\n" +
                "F 1 5 9 1 7 5\n" +
                "F 2 12 12 19 4 2\n" +
                "F 2 5 10 8 6 4\n" +
                "F 2 6 19 13 9 7\n" +
                "F 2 9 16 19 4 2\n" +
                "F 2 2 3 19 6 4\n" +
                "F 2 5 2 8 6 4\n" +
                "F 2 11 8 13 6 4\n" +
                "F 2 4 5 16 6 4\n" +
                "F 2 3 12 19 4 3\n" +
                "F 2 5 10 8 6 5\n" +
                "F 2 5 19 13 9 8\n" +
                "F 2 9 16 19 4 3\n" +
                "F 2 2 3 19 6 5\n" +
                "F 2 5 2 8 6 5\n" +
                "F 2 11 8 13 6 5\n" +
                "F 2 4 5 16 6 5\n" +
                "F 1 4 6 15 6 5\n" +
                "F 1 5 1 6 6 5\n" +
                "F 1 5 9 1 7 6\n" +
                "go\n");
            #endregion

            //actually 61, but 42 grouped
            Assert.AreEqual(42, pw.Fleets().Count);

            int num = 0;
            foreach (Fleet fleet in pw.Fleets())
            {
                num += fleet.NumShips();
            }
            Assert.AreEqual(506, num);
        }
Ejemplo n.º 2
0
		public static string SerializeGameState(PlanetWars pw, bool forLog)
		{
			return SerializeGameState(pw.Planets(), pw.Fleets(), forLog);
		}