Before using this project, ensure you have a recent version of Node.js installed on your system. You can download and install Node.js from the official website:
To set up the project, follow these steps:
- Clone this repository to your local machine.
- Open a terminal in the project directory.
- Run the following command to install dependencies:
npm install
This will install Mocha, the testing framework.
To execute all tests and verify that the project is functioning correctly, run:
npm test
To run the binary, you have two options:
Run the following command:
npm run robot
Run the binary file directly using Node.js:
node bin/robot.mjs
Once the binary is running, you can manually enter instructions line by line, exactly as shown in the assignment examples.
> node bin/robot.mjs
5 5
1 2 N
RFRFFRFRF
Report: 1 3 N
In this example:
- The first line (
5 5
) defines the grid size. - The second line (
1 2 N
) sets the robot's starting position and direction (North). - The third line (
RFRFFRFRF
) provides movement instructions. - The output (
Report: 1 3 N
) shows the robot's final position and direction.