Your task is to build a client-server system to represent an ASCII art drawing canvas. The exercise involves two pieces:
- A server that will implement the drawing endpoints into a canvas.
- A read-only client that will show the canvas stored by the server with the drawings.
- correctly functioning solution that comes with running instructions and examples.
- readable, clear code of the kind you would yourself like your team-mates to write and maintain with you.
- appropriately automatically tested, including failure scenarios.
- appropriate data structures and algorithms being applied as part of your solution.
- a version history being included with your solution.
- implementing the canvas behaviours described below into a web service API as you see fit.
- written in Elixir if you are applying to an Elixir position, and in Go, if you are applying to a Go position. In case this a a mixed position, please, clarify with the recruiter.
- automatically tested appropriately.
- runnable with clear running instructions.
- identifiable with a globally unique identifier.
- persisted across application launches.
- not authenticating users: authenticating or authorizing requests is out of scope.
- A rectangle parameterised with...
- Coordinates for the upper-left corner.
- width and height.
- an optional fill character.
- an optional outline character.
- One of either fill or outline should always be present.
A character can be assumed to be an ASCII encoded byte.
The canvas can be assumed to be a fixed size.
- Non-interactive: you do not need to implement any client-side interactions. Read-only.
- simple: you can implement the drawing operations with constant-width characters.
- runnable with clear running instructions.
- Rectangle at [3,2] with width: 5, height: 3, outline character:
@
, fill character:X
- Rectangle at [10, 3] with width: 14, height: 6, outline character:
X
, fill character:O
@@@@@
@XXX@ XXXXXXXXXXXXXX
@@@@@ XOOOOOOOOOOOOX
XOOOOOOOOOOOOX
XOOOOOOOOOOOOX
XOOOOOOOOOOOOX
XXXXXXXXXXXXXX
- Rectangle at
[14, 0]
with width7
, height6
, outline character: none, fill:.
- Rectangle at
[0, 3]
with width8
, height4
, outline character:O
, fill:none
- Rectangle at
[5, 5]
with width5
, height3
, outline character:X
, fill:X
.......
.......
.......
OOOOOOOO .......
O O .......
O XXXXX .......
OOOOOXXXXX
XXXXX
- Go
- Docker
- docker-compose
./dockerise.sh
POST localhost:8888/canvas/add
GET localhost:8888/canvas?id={id}
[
{
"RectangleAt" : [3,2],
"Width": 5,
"Height":3,
"Outline": "@",
"Fill": "X"
},
{
"RectangleAt" : [10,3],
"Width": 14,
"Height":6,
"Outline": "X",
"Fill": "O"
}
]
{
"CanvasID": "ff89e33b-4cd5-45b1-af19-5e6ad7288412",
"Drawing": [
" ",
" ",
" @@@@@ ",
" @XXX@ XXXXXXXXXXXXXX",
" @@@@@ XOOOOOOOOOOOOX",
" XOOOOOOOOOOOOX",
" XOOOOOOOOOOOOX",
" XOOOOOOOOOOOOX",
" XXXXXXXXXXXXXX"
]
}