diff --git a/README.md b/README.md index 9b46a51..bb165dc 100644 --- a/README.md +++ b/README.md @@ -70,4 +70,36 @@ REPORT Output: 3,2,NORTH ``` +### Design Decisions +The library (module in Python terminology) `toyrobot` contains just one class, `Robot`, that is aware of both its movement limits (configurable, but defaults to the 6x6 space in the original description) and can also interpret text commands. This monolithic design is appropriate given the simplicity of the problem as provided, but further separation of concerns may be desirable in a more complex application or context. + +As per the spirit of the description, most methods are designed to "fail silently" (i.e. leave the Robot state unchanged) if they are invalid or are given invalid inputs. The one exception to this is the ``__init__`` constructor - if numerically invalid maximums are provided for movement limits then a ValueError exception is thrown. This ensures that a Robot instance cannot exist with an invalid initial state or configuration. + +## Installation and Pre-requisites + +Python version 3.10 or above is required due to the use of the `match/case` construct. + +No external libraries are used, and a Python virtual environment is not necessary. + +## Usage + +To run the examples listed in the problem description: + +``` +python trexamples.py +``` + +## Unit Tests + +A number of basic unit tests are included using the internal Python library `unittest`. These are not exhaustive, but do provide testing of the expected behaviour of the essential methods of the `Robot` class. For ease of reference these are all included in a single class, although it is worth noting that as per the `unittest` [documentation](https://docs.python.org/3/library/unittest.html) many of these should technically be in separate classes with individually specified "setup" and "takedown" code. + +To run the tests, use the command: + +``` +python -m unittest -v trtests.py +``` + +### Author + +Chris Davoren, 2023, cdavoren@gmail.com