Git Product home page Git Product logo

mars-rover's Introduction

Mars Rover

A kata about Events in Node.js

About

It is a practical example about how to build software from the requirements starting with building an API contract first.

In the thecnical part, main concepts of JavaScript as Events ,async code and callbacks are shown.

It is a good example about how to test callbacks from an event.

Instructions

A Mars rover need instruction from control tower to operate. Because of the distance between them, commands are received asynchrony.

Main task

Implemet a move command and notify when the rover moves

move(dir, numOfSteps)

example: move('N',4)
  • dir must be one of the following options = ['N','S','E','W']

  • numOfSteps must be positive integer numbers

Implementation rules

  1. All commands take 100ms x number of steps
  2. Must use Node.js EventEmitter to signal new position
  3. getPosition method is not allowed to be implemented
  4. move method should return sucess or error. Coordinates are not allowed to be returned

Installation

npm install

Test

npm test

Execution

npx tsx src/step2.ts

Implementation process

in Step 1 is described the API contract. The requirements are taking as an input and them are translated into code. There is no functionality yet but the goal of what is desired to archive is stablish.

Step 2 is where the building of the functionality start. The input here is the previus step and the goal is to make it work.

mars-rover's People

Contributors

mlopezj 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.