Ejemplo n.º 1
0
        /// <summary>
        ///  main function
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler((object sender, System.ConsoleCancelEventArgs e)
                                                                    => {
                Console.WriteLine("exiting...");
                System.Environment.Exit(0);
            });

            try
            {
                string debugfile = GetConfigStringValue(Configurations.DebugLog);
                Logger.Init(debugfile);

                int tableRangeX = GetConfigIntValue(Configurations.TableLimitX, 5);
                int tableRangeY = GetConfigIntValue(Configurations.TableLimitY, 5);

                WelcomeMessage(tableRangeX, tableRangeY);
                ToyTable tb    = new ToyTable(tableRangeY, tableRangeX);
                ToyRobot robot = new ToyRobot(tb);
                StartUserInput(robot);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
                System.Environment.Exit(1);
            }
        }
Ejemplo n.º 2
0
        public ToyRobot(ToyTable table)
        {
            if (table == null)
            {
                throw new ArgumentException("table can not be null");
            }

            this._table = table;
        }