コード例 #1
0
        public static void Main(string[] args)
        {
            var result = true;

            mazeGame = DependencyFactory.Resolve <IMazeGame>();
            mazeGame.StartNew(new Coordinate(10, 10));
            //ShowOptions();
            while (result)
            {
                var input = Console.ReadKey();

                result = Execute(input);
                if (!result)
                {
                    result = Execute1(input);
                }
            }
        }
コード例 #2
0
        public static bool Execute1(ConsoleKeyInfo input)
        {
            string inputChar = input.KeyChar.ToString().ToUpperInvariant();

            if (inputChar == "S")
            {
                mazeGame.Solve();
                return(true);
            }
            else if (inputChar == "N")
            {
                mazeGame.StartNew(new Coordinate(10, 10));
                return(true);
            }
            else if (input.Key == ConsoleKey.Escape)
            {
                return(false);
            }
            return(true);
        }