Following guide is for Mac users and most of the steps would be the same. Please follow OS specific guidelines whenever required.
-
Install NVM
http://dev.topheman.com/install-nvm-with-homebrew-to-use-multiple-versions-of-node-and-iojs-easily/
-
Install node.js version 12.16
nvm install 12.16
-
Install Typescript
npm install -g typescript
-
Install Dependencies (I have used Yarn and yarn.lock file has been pushed to the repository)
yarn install / npm install
Start the application using the following command and keep entering robot commands on the CLI. Please input commands one by one. Ex: Enter the PLACE command first and then press enter key, and repeat the same for other commands. Once the REPORT command is entered, it will display the current position of the robot.
yarn start / npm start
? Please enter the command >> PLACE 0,0,1 (press enter)
? Please enter the command >> MOVE (press enter)
? Please enter the command >> REPORT (press enter)
Current position is: 0,1,NORTH
PLACE 1,2,EAST
MOVE
MOVE
LEFT
MOVE
REPORT
Output: 3,3,NORTH
PLACE 0,1,SOUTH,
MOVE,
RUN,
RIGHT,
MOVE,
REPORT,
Output: 0,0,WEST
PLACE -1,-2,EAST
MOVE
RIGHT
MOVE
REPORT
Output: Invalid place command!. Please correct it and try again.
MOVE
RIGHT
REPORT
Output: Please enter a valid PLACE command as the first command!
yarn test / npm run test
yarn test:coverge / npm run test:coverage
yarn lint / npm run lint
- src - Source folder
- test - Test folder
- index.ts - Starting point of the application