Coder Social home page Coder Social logo

marsrovers's Introduction

Mars Rover

Mars Rover that is able to accept commands and move around on a grid.

Design Aspects:

From the beginning I knew that I wanted to make my code as modular as possible:

  • Create a CommandParser that turned the user input into a usable format

  • From there, create the Grid module that can have MarsRovers placed on it

  • Create a MarsRover class that can maintain the state of each Rover and execute the provided commands

  • Create an ApplicationController that uses the different modules like lego pieces to make the overall application run

  • I constantly strived to keep each module as a separate entity with little to no intertwined dependencies

  • Single responsibility and object oriented design were a very high priority for me throughout the project

  • I wanted the code to be able scaleable and therefore made sure to only commit code that was extensively tested: TDD'd!

  • Constantly built the next smallest thing until the whole application was realized.

  • It was also important to me to create a visual representation that allowed the user to get visual feedback that the application was working

Assumptions Made Along Way:

  • The CommandParser would be a key component to the functionality of the application

  • A scaleable MarsRover application would need to be able to have multiple rovers be instantiated and commanded

  • I had initially thought that the value '5 5' would mean that I could easily represent the grid as an array with 25 units. However, I later realized that my Grid would have to represent the actual nodes meaning I would have to have 36 nodes.

As an illustration, I drew out a 3x3 box, made up of 9 small squares. I learned along the way that my initial design had to be reworked. Each array unit would have to represent the 12 nodes that compose the 3x3 box.

Once I restructured my code to encompass this change, it became possible to represent the rovers moving along the axes of my grid.

To Run the Application:

  1. From the Terminal, go into the root directory
  2. Copy and Paste the Following Code:
  • ruby mars_rover_application.rb

For funsies:

Run with three rovers:

  • ruby mars_rover_application.rb 3_rovers.txt

Run with eight rovers:

  • ruby mars_rover_application.rb 8_rovers.txt

To Run the 40 Tests:

  1. From the Terminal, go into the root directory
  2. Copy and Paste the Following Code:
  • rspec mars_rover_application_spec.rb application_controller_spec.rb rover_command_parser_spec.rb grid_spec.rb mars_rover_spec.rb

marsrovers's People

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.