1 using System;
2 using System.IO;
3
4 class Program {
5 static void Main(string[] args) {
6
7 try {
8
9 bool extraCredit = args.Length>1;
10
11
12 StreamReader reader = new StreamReader(args[0]);
13 int N = Convert.ToInt32(reader.ReadLine());
14
15
16 string filename = System.IO.Path.GetFileNameWithoutExtension(args[0]);
17 TextWriter tw = new StreamWriter(filename + (extraCredit?"GR":"") + ".txt");
18
19
20 for(int i = 1; i<=N; ++i) {
21
22
23 string problem = reader.ReadLine();
24 string[] parts = problem.Split(' ');
25 string forward = parts[0];
26 string backward = parts[1];
27
28 tw.WriteLine("Case #" + i + ':');
29 TestCase testCase = new TestCase(forward, backward);
30 testCase.execute();
31
32
33 if (extraCredit) testCase.maze_.writeGraphically(tw);
34 else testCase.maze_.write(tw);
35 }
36
37 tw.Close();
38 reader.Close();
39 }
40
41 catch(Exception x) {Console.Write(x.Message.ToString());}
42 }
43 }