Bionamic code test

The purpose of the code test

The code test is meant to for candidates to show that they can write and structure code. The code test can be done at home and candidates can take as much time as they want. The result does not need to be perfect. The code will be used as a starting point for a further discussion. The purpose of the code is to start a discussion about programming and related topics. The techniques used to solve the test are very relevant for the work done at Bionamic.

The diamond race

The purpose of the test is to write a tiny game called the diamond race. The 3 figures below show the game. Four colored diamonds move from the start line to the finish. A click on a diamond moves it one step to the right. It takes 10 steps to win. The score board shows the current scores. When one diamond has a score of 10, the diamonds stop responding to clicks. The reset button takes the diamonds back to start. If any rules are unclear, an arbitrary choice can be made by implementation.

Requirements and recommendations

Illustration of the diamond race

Figure 1. The start of the diamond race. The 4 diamonds are aligned at the start. Clicking a diamond moves it one step to the right.
Figure 2. The middle of the diamond race. The 4 diamonds have been clicked multiple times. The score board shows the number of clicks on the diamonds. Clicking the reset button takes the diamonds back to start.
Figure 3. The end of the diamond race. The blue diamond has won by moving 10 steps. The score board shows the score of the blue diamond in red. When one diamond has won, clicking the diamonds will not move them anymore. The reset button must be clicked to start again.