Workshop refrence Bot controlled with your keyboard

just add to the program.cs file we were provided to use user input for anyone that wants to explore the map.

private static InputCommand GetInputCommandFromKeyboard()
// Check if a key is available
if (Console.KeyAvailable)
// Read the key
var key = Console.ReadKey(intercept: true).Key;

            // Map the key to the corresponding InputCommand
            switch (key)
                case ConsoleKey.UpArrow:
                    return InputCommand.UP;
                case ConsoleKey.DownArrow:
                    return InputCommand.DOWN;
                case ConsoleKey.LeftArrow:
                    return InputCommand.LEFT;
                case ConsoleKey.RightArrow:
                    return InputCommand.RIGHT;
                case ConsoleKey.Escape:
                    // Handle any specific key you want to use to exit the program
                    // For example, you can terminate the program when the Escape key is pressed

        // If no key is available or no corresponding InputCommand is found, return a default value
        return 0;
1 Like