Ejemplo n.º 1
0
		public static void Main(string[] args) {
			if(args.Length < 2) {
				Console.WriteLine("Usage: ./sim file.desc sim_length");
				return;
			}
			var ds = new DescriptionParser();
			var city = ds.Parse(System.IO.File.ReadAllText(args[0]));
			if(city == null)
				return;
			for(int i = 0; i < 1; i++) {
				city.SimulateTurn();
				if(city.ShieldsDown()) {
					Console.WriteLine("Alert ! Shields are down after {0} turns !", 1);
					return;
				}
				Console.WriteLine(city);
			}
			Console.WriteLine("Congratulations, this configuration held for {0} turns !", 1);
		}
Ejemplo n.º 2
0
 public static void Main(string[] args)
 {
     if(args.Length < 2) {
         Console.WriteLine("Usage: ./sim file.desc sim_length");
         return;
     }
     var ds = new DescriptionParser();
     var city = ds.Parse(System.IO.File.ReadAllText(args[0]));
     if(city == null)
         return;
     var simlen = Int32.Parse(args[1]);
     for(int i = 0; i < simlen; i++) {
         city.SimulateTurn();
         if(city.ShieldsDown()) {
             Console.WriteLine("Alert ! Shields are down after {0} turns !", i);
             return;
         }
         Console.WriteLine(city);
     }
     Console.WriteLine("Congratulations, this configuration held for {0} turns !", simlen);
 }