Code Monkey home page Code Monkey logo

mars-rover-js's Introduction

Mars Rover Javascript

This is a solution for a proposed challenge that you can look at CHALLENGE.md

Setting Up

Before running either the entire solution or just the tests you must prepare a Elastich Search simple http service at your machine using Docker Compose. Run at root:

docker compose up -d

Running

Install

Install dependencies running:

yarn

Scripts

Take a look at the examples below to understand the supported input format of the solution. The input format should look exactly how it is at the examples.

Build Your Own Rover Example

The solution receives three kind of parameters:

Parameter Format Meaning Example Rover data
Plateau/Grid dimensions <INTEGER>, <INTEGER> X limit and Y limit. The upper-right-corner limit. 5,5 No
Rover starting position <INTEGER>,<INTEGER>,<CHARACTER> X position, Y position and orientation {where it is pointing to [should be N (North), S (South), W (West) or E (East)]} 1,1,W Yes
Rover instructions <CHARACTER[]> The sequence of instruction that the rover should follow LMRMLMLMLMR Yes

Running at your shell, the parameters should be separated by spaces and look like this:

yarn rover 8,8 1,2,N LMLMLMLMM
# 8,8 means a 9x9 [since the hardcoded lower-left corner (0, 0) is a valid position]
# 1,2,N is the rover starting position and orientation
# LMLMLMLMM is the instructions to rover where L means left, R means right and M means move
Rover Data

You can inform multiple rover data params to run two or more rovers in the same execution:

npm start 8,8 1,2,N LMLMLMLMM 3,3,E MRRMMRMRRM

Example 1

Run the example 1 input from CHALLENGE.md

yarn example1

Example 2

Run the example 2 input from CHALLENGE.md

yarn example2

Examples (both in the same execution)

Run both examples from CHALLENGE.md in the same execution

yarn examples

Checking Stored Log Data

Store the log of the executions was part of the challenge. To check what data has been stored using you browser โ€” after running a pre-made or a custom example โ€” type at the url field: http://localhost:9200/input-logs/_search or http://localhost:9200/output-logs/_search.

Tests

The project has basic tests, you can run it by running:

yarn test

mars-rover-js's People

Contributors

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