SUPER EFFICIENT DRAWING BOARD
- The best solution will receive an Amazon Kindle
- The second best solution will receive a Sony Headphone
- Implement a basic canvas
- Implement the logic to draw lines on this canvas
- Implement a logic to calculate the amount of distance covered while drawing on the canvas.
- Consider each pixel to be 1 meter.
- Implement a logic to replay the drawing events.
- This should be time based. Supposed the second pixel was drawn on the canvas after 1 second of the first pixel drawn, then this should also be reflected in the replay as well.
- Store the events in a way that you require the least amount of data to replay the whole drawing.
- This data should be as compressed as possible.
- The data should be as minimal as possible.
Ex: Suppose to draw a line, you used events in the following order
1. mouseDown
2. drag(s)
3. mouseUp
Example:
[
{
type: 'down',
x-point: 0,
y-point: 0
},
{
type: 'drag',
x-point: 1,
y-point: 0
},
{
type: 'drag',
x-point: 2,
y-point: 0
},
{
type: 'up',
x-point: 2,
y-point: 0
}
]
Then you need to reduce the overall size of the array, and the size of the individual objects.
- The code quality.
- The accuracy of the various logics involved.
- The optimization of the logic to compress the data required to replay the session.
- Raise a pull request (PR) for this repository
- Mention your details here:
- Name:
- Email:
- Contact Number:
- Company Name: