Skip to content

Latest commit

 

History

History
82 lines (57 loc) · 2.58 KB

README.md

File metadata and controls

82 lines (57 loc) · 2.58 KB

Project Source Implementation

Library

Entity

The entity module contains the Table and Object classes.

The classes has an Aggregate relationship (Table is the aggregate root, which could contain one or more Object).

  • table
    Aggregate root. Can contain one or more Objects.
  • objects
    • robot
      An object which can be added into the table.

Handler

The handler module receives requests from the application.
An Application needs to have a RequestHandler object to use the Library.

The following are the main methods an Application is expected to use:

  • RequestHandler::CreateRequest()
    Method to create requests/commands.
  • RequestHandler::HandleCommmand()
    Method to execute the requests/commands.

Sample application:

  RequestHandler handler;

  BaseRequest *request = handler.CreateRequest("PLACE", "0,0,NORTH");
  BaseResponse *response = handler.HandleCommand(request);

Request

The request module contains the Request objects which can be sent by an application into the handler module.

Response

The response module contains the Response objects which can be sent to the application from the handler module.

Value

The value module contains the Value objects used within the library.

Application

Single Robot

The single robot is a sample application which solves the coding challenge.

A single robot can be placed and controlled within the Table.

How to Run the Application

In the src directory, the application can be built from the command line using make command.

make

An executable named main is created after the compilation is successful.

When the Application is executed, commmands can be received from the command line or from an input file.

  • Running the application and sending commands from standard input
    ./main
    
  • Running the application and sending commands from input file
    ./main < {location of input file}
    

File inputs for the Application

Sample input files are available below:

  • input1.txt
    This input file contains sample Input and Output from the Specifications
  • input2.txt
    This input file contains multiple invalid commands to test that the Application is robust to User input.
  • input3.txt
    This input file makes a toy robot traverse the whole table while trying not to fall.