Instantly share code, notes, and snippets.

@tmaybe /README.md Secret
Last active Apr 17, 2017

Embed
What would you like to do?

Set-up Instructions

  • Clone this gist to your computer
    • git clone git+ssh://git@gist.github.com/1c23f58f33c0040853556dee4051d752.git rover-node
    • cd rover-node
  • Move rover_test.js in to a folder named test in the same directory as rover.js to start
    • mkdir test
    • mv rover_test.js test
  • Install dependencies (mocha, for running tests)
    • npm install
  • Run the tests to verify that everything's set up correctly
    • mocha test/rover_test.js

Build Instructions

We're going to build the API for a Mars rover using a test-driven approach. Some things that the rover could do:

* know which compass direction it is facing
* know where it is relative to its landing position
* move forward
* turn left and right
* follow a list of single-character commands (f,l,r)
* move backward (b)
* sense whether there is an obstacle
* refuse to move forward if the path is blocked
* anything else you think would be interesting
{
"name": "rover-node",
"version": "1.0.0",
"description": "Mars rover kata in javascript",
"main": "rover.js",
"directories": {
"test": "test"
},
"dependencies": {
"mocha": "^3.2.0"
},
"devDependencies": {},
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gist.github.com/1c23f58f33c0040853556dee4051d752.git"
},
"author": "",
"license": "",
"bugs": {
"url": ""
},
"homepage": "https://gist.github.com/1c23f58f33c0040853556dee4051d752"
}
exports.Rover = function() {
this.ping = function() {
return true;
};
};
var assert = require("assert");
var rover = require("../rover.js");
describe('Rover', function() {
describe('exists', function () {
it('should respond to ping', function () {
var my_rover = new rover.Rover();
assert.ok(my_rover.ping());
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment