1 using System; 2 3 class Program { 4 static void Main(string[] args) { 5 try { 6 if(args.Length!=3) { 7 Console.Write("Need 3 arguments: WordsFile, width, height"); 8 return; 9 } 10 11 GridDimensions gridDimensions = new GridDimensions(Convert.ToInt32(args[1]), 12 Convert.ToInt32(args[2])); 13 Grid grid = new Grid(gridDimensions); 14 WordList wordlist = new WordList(args[0]); 15 Grid result = grid.placeSublist(wordlist); 16 if (result==null) Console.Write("Arranging words into grid failed.\n"); 17 else result.write(); 18 } 19 20 catch(Exception x) {Console.Write(x.Message.ToString());} 21 } 22 }