예제 #1
0
파일: Roomba.cs 프로젝트: LeoRoma/RoombaCS
        static void Main(string[] args)
        {
            //string contents = File.ReadAllText(@"Input.txt", Encoding.UTF16);

            try
            {
                Room room = new Room(5, 5);

                Hoover hoover = new Hoover(new RoomLocation(1, 2, room));

                Dirt dirts = new Dirt(
                    new List <RoomLocation>
                {
                    new RoomLocation(1, 0, room),
                    new RoomLocation(2, 2, room),
                    new RoomLocation(2, 3, room),
                }
                    );

                Instruction instruction = new Instruction("NNESEESWNWW");

                hoover.Move(instruction, dirts, room);
            }
            catch (OutOfBoundsException ex)
            {
                Console.WriteLine(ex);
            }

            catch (HitWallException ex)
            {
                Console.WriteLine(ex);
            }
        }