/toy-robot

Primary LanguageJavaScript

David Piçarra - Toy Robot

CircleCI Coverage Status Vue 2.x

A Vue.js project to solve the Toy Robot challenge

Table of Contents

Demo

Demo

What was done

A component called ToyRobot.vue was created to allow a Robot to be place in a 5x5 grid. The following commands are available:

help() // shows available commands
place(x, y, facing) // place the robot at x, y location and facing the direction provided
move() // moves the robot 1 unit forward in the direction it's facing
left() // rotate left 90 degrees anti-clockwise
right() // rotate right 90 degrees clockwise
report() // outputs current robots location and direction
clear() // clear the messages

Created unit test with 100% coverage and added specific test to try the scenario provided:

should execute the sample test correctly

How to run the app

In order to run the app locally, the following commands must be executed:

# npm
$ npm install
$ npm run dev

# yarn
$ yarn
$ yarn dev

Build setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

# run unit tests
npm run unit

# run all tests
npm test

For a detailed explanation on how things work, check out the guide and docs for vue-loader.