This is my go at the Mars Rover challenge set by the RDT work experience. I did all of the prototypes in OOP in Python without any extra libraries—just messing around with Python. Sources will be linked in this repo.
There is a plateau on Mars with more than one rover. The rovers can face North, South, East, or West, and they move forward depending on the direction they are facing. This is represented by directions like N, S, E, W. M is the command to move forward. The program checks if the rover falls off the plateau.
First, I started by breaking the wordy problem down into something I could understand in my head. I used a notebook, abstracted it down to the bare bones, and made minimum viable product criteria that I could follow. Then I started by building a single rover. This was the stage where I was trying to figure out different approaches to solving the problem. This can be seen through the prototypes in the repo.
- Make sure you have Python 3 installed.
- Download/clone this repo and open a terminal in the repo folder.
- Run the script: multiple_rovers_main.py
(2 rovers)
Rover 1
input : 55
input : 1 2 N
input : LMLMLMLMM
expected output : 1 3 N
output : 1 3 N
Rover 2
input : 3 3 E
input : MMRMMRMRRM
expected output : 5 1 E
output : 5 1 E