MartinStamenkovski / Pizzabot

Instruct bot to deliver pizzas to given points.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

logo

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.

About

Instruct bot to deliver pizzas to given points.

License:GNU General Public License v3.0


Languages

Language:Swift 100.0%