https://github.com/pcmunoz/nodejs-toy-robot
Place a robot on a table via CLI
https://github.com/pcmunoz/nodejs-toy-robot
Last synced: over 1 year ago
JSON representation
Place a robot on a table via CLI
- Host: GitHub
- URL: https://github.com/pcmunoz/nodejs-toy-robot
- Owner: pcmunoz
- License: mit
- Created: 2022-05-25T17:15:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-26T00:43:40.000Z (about 4 years ago)
- Last Synced: 2025-01-21T10:51:22.147Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Toy Robot Challenge
Place a robot on a table. Move it in any direction within the table. The robot will not fall during movement.
==Note: PLACE first the robot to use other commands. QUIT command will always work.==
Point 0,0 is on the SOUTH WEST corner. Out of bounds is negative position and max table dimension(x,y).
Max table config can be found on _src\config.ts_. If config file is edited, build and run to reflect change.
Install, Build and Run
## Installation
> npm install
## Build and Run
> npm run start
#### Build only
> npm run build
#### Run only
> npm run build:run
## Commands
#### PLACE X,Y,DIRECTION
This will place the robot in the table on x,y coordinates and the direction.
If x,y is not within the table, robot will not be placed.
#### MOVE
This will move the robot **one unit on the direction** it is facing.
#### LEFT
This will rotate the direction of the robot to the left. E.g. North -> West
#### RIGHT
This will rotate the direction of the robot to the right. E.g. North -> East
#### REPORT
This will show the current position and direction of the robot.
#### QUIT
The end.
## Run Test
> npm run test
## Lint
#### Check
> npm run lint
#### Fix
> npm run lint:fix