Pizzabot
Instruct Pizzabot on how to deliver pizzas to all the houses in a neighborhood. In more specific terms, given a grid (where each point on the grid is one house) and a list of points representing houses in need of pizza delivery, return a list of instructions for getting Pizzabot to those locations and delivering. An instruction is one of:
- N: Move north
- S: Move south
- E: Move east
- W: Move west
- D: Drop pizza
Pizzabot always starts at the origin point, (0, 0). As with a Cartesian plane, this point lies at the most south-westerly point of the grid.
Therefore, given the following input string:
5x5 (1, 3) (4, 4)
one correct solution would be:
ENNNDEEEND
How to run this project
Clone this repo, open playground in Xcode.
Read comments writen for the functions, execute the program with your predifined input and output.
The assertions will tell you if something is wrong with the program, so you can correct your input or output.
The main function to provide input and output is called pizzabot.