Coder Social home page Coder Social logo

slice-pizzabot's Introduction

Pizzabot

Author

Sergei Cherebedov

Description

PizzaBot is a robot that delivers pizza. It takes particular instructions on how to deliver pizzas to all the houses in a neighborhood.

How it Works:

It uses the following instructions:

  • 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 southwesterly point of the grid. For example Pizzabot receives the following input string: 5x5 (1, 3) (4, 4). It means that grid has 5x5 size, (1, 3) (4, 4) are the points to deliver pizza. The result string will be ENNNDEEEND. In other words: move east once and north thrice; drop a pizza; move east thrice and north once; drop a final pizza.

Environment

node -v
## v17.2.0
npm -v
## 8.1.4

Build and run

Execute commands

npm install
npm start

Open page http://localhost:3000/ and follow instructions

Algorithm

  1. Get targets array from params and check that this targets inside field size.
  2. Function getOptimalPath in getPath file. Start from [0, 0] and find nearest target, then do it again from founded target (finding nearest target, but exclude processed targets).
  3. Show path in text and in image.

Testing

For test run npm test, test files you can find in src like a *.test.ts. I use jest for it.

slice-pizzabot's People

Contributors

sonic16x avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.