Keine Beschreibung

Oz N Tiram a5aebb35bc Update the README vor 4 Jahren
src d0adbd9016 Add north bound movements and reporting vor 4 Jahren
tests d0adbd9016 Add north bound movements and reporting vor 4 Jahren
.gitignore 08ca49e4be Add the first code to create a Rover instance vor 4 Jahren
Makefile 8759015bab Add shortcut target to run all the tests vor 4 Jahren
Pipfile 3a997d0dde Initial commit vor 4 Jahren
README.md a5aebb35bc Update the README vor 4 Jahren
requirements-test.txt 3a997d0dde Initial commit vor 4 Jahren
requirements.txt 3a997d0dde Initial commit vor 4 Jahren
setup.cfg 08ca49e4be Add the first code to create a Rover instance vor 4 Jahren
setup.py 3a997d0dde Initial commit vor 4 Jahren

README.md

Mars Rover Kata - version 1.2

This is a solution to the Kata in Python3.

The requirements to run this code are:

  • Python3
  • pip
  • GNU Make (optional)

To run the code create a virtual environment and install the dependencies and then the code itself. If you are familiar with Python you can also use pipenv and skip the following instructions:

# These istructions assume you use a shell on a UNIX like system (Mac or Linux)
$ python3 -m venv rover-env
$ source rover-env/bin/activate
$ pip install -r  requirements.txt

If you have GNU Make installed on your system you can simply use:

$ make setup/dev
$ source rover/env/activate

USAGE

Here is a short example how one can use the Rover class:

  1. Land at user specified location

    >>> r = Rover(x=2, y=2, heading='N')
    >>> r.move("FFF")
    Location (2, 5) Heading N
    
  2. Land at random location:

    >>> from rover import Rover
    >>> r = Rover()
    /home/oznt/Software/mars-rover/src/rover/rover.py:20: UserWarning: Landing at a random place
    warnings.warn("Landing at a random place")
    >>> r.location
    <rover.rover.Location object at 0x7f3dae21e160>
    >>> r.location.x
    9
    >>> r.location.y
    -8
    >>> r.location.heading
    'S'
    >>> r.location.heading = 'N'
    >>> r.move('FFF')
    Location (9, -5) Heading N
    
    

The interface is very minimal and on can only land and move the rover towards the north and the east.