Note: This is a Python implementation of the classic Mars Rover problem. It processes string input, controls rovers on a grid plateau, and avoids collisions.
This project simulates rovers landing on Mars and navigating a plateau grid.
- Rotate left or right
- Move forward
- Check plateau boundaries
- Avoid collisions
Architecture separates:
- Domain Models (data classes and enums)
- Input Parsers
- Logic Layer (movement, collisions, mission control)
- Integration Layer (
main.py
entry point)
py-mars-rover/
β
βββ src/
β βββ logic/
β βββ parsers/
β βββ utils/
β βββ main.py
β
βββ test/
βββ README.md
-
Clone the repository:
git clone https://github.com/yourusername/py-mars-rover.git cd py-mars-rover
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the program:
python src/main.py
Tip
The default input is:
Plateau size: 5 5
Rover position: 1 2 N
Instructions: LMLMMLLMMMR
The expected output:
Rover final position: 0 3 E
Run all tests using:
pytest
-
Entry point:
src/main.py
-
Rover logic:
src/logic/rover.py
-
Parsers:
PlateauParser
PositionParser
InstructionParser
-
Customize inputs:
- Modify
main()
- Or use
MissionControl
directly
- Modify
MIT License