Giter VIP home page Giter VIP logo

bus-in-carpark-simulator's Introduction

Bus In Carpark Simulator

The application is a simulation of a robot operated bus moving in a carpark.

Table of contents

Quick Start

  • Install all project dependencies with npm install
  • Start the development server with npm start
  • Start Development Mode with npm run dev
  • Test test-cases & code coverage with npm test
  • Build all project source code with npm run build

Examples

Here is some example input and output:

# input 
PLACE 0,0,NORTH
MOVE
REPORT

# output
info: Output: 0,1,NORTH
# input 
PLACE 0,0,NORTH
LEFT
REPORT

# output
info: Output: 0,0,WEST
# input 
PLACE 1,2,EAST
MOVE
MOVE
LEFT
MOVE
REPORT

# output
info: Output: 3,3,NORTH

Documentation

Source Code Structure

├── README.md
├── LICENSE
├── input.txt (input data)
├── .gitignore
├── .babelrc
├── webpack.config.js
├── package.json 
└── src
      ├── utils
      │   ├── logger.js
      │   ├── file.js
      │   └── file.test.js
      ├── bus 
      │   ├── bus.js
      │   ├── bus.test.js
      │   ├── carpark.js
      │   └── carpark.test.js
      ├── command 
      │   ├── commands.js
      │   ├── commands.test.js
      │   ├── directionInfo.js
      │   ├── constantCommands.js
      │   ├── process.js
      │   └── process.test.js
      ├── test 
      │   ├── integration.test.js
      │   ├── typicalCase.txt
      │   ├── tooManyMoveCommands.txt
      │   ├── commandsWithoutPlaceCase.txt
      │   └── commandsWithoutMoveCase.txt
      └── index.js

App Description

  • The application is a simulation of a robot operated bus moving in a carpark, of dimensions 5 units x 5 units.
  • There are no other obstructions in the carpark.
  • The bus is free to roam around the carpark, but must be prevented from exiting the carpark. Any movement that would result in the bus leaving the carpark must be prevented, however further valid movement commands must still be allowed

App Functionality

The application should be able to read in any one of the following commands:

  1. PLACE X,Y,F
  2. MOVE
  3. LEFT
  4. RIGHT
  5. REPORT
  • PLACE will put the bus in the carpark in position X,Y and facing NORTH, SOUTH, EAST or WEST.
  • The origin (0,0) can be considered to be the SOUTH WEST most corner.
  • The first valid command to the bus is a PLACE command, after that, any sequence of commands may be issued, in any order, including another PLACE command. The application should discard all commands in the sequence until a valid PLACE command has been executed.
  • MOVE will move the bus one unit forward in the direction it is currently facing.
  • LEFT and RIGHT will rotate the bus 90 degrees in the specified direction without changing the position of the bus.
  • REPORT will announce the X,Y and F of the bus. This can be in any form, but standard output is sufficient.
  • A bus that is not in the carpark should ignore the MOVE, LEFT, RIGHT and REPORT commands.
  • Input can be from a file, or from standard input, as the developer chooses.
  • Provide test data to exercise the application.

App Constraints

  • The bus must not exit the carpark during movement. This also includes the initial placement of the bus.
  • Any move that would cause the bus to exit the carpark must be ignored.

bus-in-carpark-simulator's People

Contributors

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