- Language specific best practices
- Clear commit history
- Maintainability: is it written in a clean, maintainable way?
- Correctness: does the functionality act in sensible, thought-out ways? Are we sure (i.e. via testing) that the code works?
After using the correct environment (Node.js v18) and installing dependencies you can develop the application.
Navigate to the Typescript directory with cd typescript
Run the with npx ts-node index.ts
Run all test cases with npx jest
Navigate to the Python directory with cd python
Run the with poetry run python main.py
Run all test cases with poetry run pytest
A truck factory's test facility needs a program to verify truck movements.
There are three possible movements:
- turn right
- turn left
- advance
Trucks are placed on a hypothetical infinite grid, facing a particular direction (north, east, south, or west). They have a a set of {x,y} coordinates, e.g. {3,8}, with coordinates increasing to the north and east.
The truck then receives a number of instructions. At the end the testing facility verifies the truck's new position and direction.
The input for movement is a string. For example "RAALAL" means:
- Turn right
- Advance twice
- Turn left
- Advance once
- Turn left yet again
Say a truck starts at {7,3} facing north. Then running this stream of instructions should leave it at {9,4} facing west.
Make commits for each iteration and do each iteration at a time. Do not focus too much on future iterations. It is not expected to finish all iterations during this interview.
The truck is on a grid and can advance:
- the truck starts at {0,0} facing north
- the truck can advance to {0,1}, {0,2}, ...
Suggestion: Defer the implementation of retrieving and parsing user input for iteration 4.
The truck can start anywhere facing any direction:
- The truck can start at any given coordinate and facing any direction
- The truck can advance in his start direction, i.e from {2,2} to {1,2} if he is facing west.
Suggestion: Defer the implementation of retrieving and parsing user input for iteration 4.
The truck can turn:
- a truck can be told to "turn left" or "turn right", which changes his direction
Suggestion: Defer the implementation of retrieving and parsing user input for iteration 4.
The simulator can parse a string input for a given start position:
- The simulator takes an input like "RAALAL" and moves the truck