A simple Mars Rover simulator with an interactive control mode Set the plateau size, land a rover with an initial direction, then control it step by step using single-key commands
- Python 3.10+ (recommended)
- pip
- A terminal that supports interactive key input
From the project root:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtWindows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txtmacOS / Linux:
source .venv/bin/activateWindows (PowerShell):
.\.venv\Scripts\Activate.ps1macOS / Linux / Windows:
python main.pyWhen prompted, enter the plateau size in the following format:
5 5
Enter the rover landing position and direction:
1 2 N
Where the direction is one of:
N— NorthE— EastS— SouthW— West
Once the map is displayed, control the rover using single-key commands:
L— turn leftR— turn rightM— move forwardQ— quit the program
Example:
- Press
Lto rotate left - Press
Mto move forward one step
- Invalid inputs will display an error message and reprint the map
- Only
L,R,MandQare accepted during control mode
