---
tags: 2assessments, GameOfLife
---
# #tty1 Assessment Review
## Assessment Summary
Please find [assessment grading](#assessment-grading) criteria and [problem statement](#problem-statement) at the bottom of this page.
| Grade | Skill | Notes |
| ------------------------------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------ |
|  | Algorithmic Programming | Correct board state management which occurs on server side. |
|  | API and Service Design | Lacking modularity with separation between various components and functionality. |
|  | Testing, CI/CD, and Site Reliability | Simple unit test coverage, use of industry-standard frameworks. Lacking integration tests. |
|  | UX Design and Prototyping | UI is intuitive. |
|  | Web Frontend | Use of jQuery to implement front-end. |
Demo: https://salty-inlet-22246.herokuapp.com/
## Assessment Details
### Algorithmic Programming
#### Summary: Correct board state management which occurs on server side.
1. Correct board state management and computation of next state.
```javascript=
function nextStep(matrixPrev) {
let matrixNew = buildEmptyMatrix();
for (let [x, y] of walkMatrix()) {
let neighbours = getNeighboursCoords(matrixPrev, x, y),
newCell = matrixNew[y][x],
prevCell = matrixPrev[y][x]
;
newCell.neighbours = neighbours;
newCell.color = prevCell.color;
if (prevCell.live) {
// check whether cell have to die
newCell.live = !((neighbours.length < 2) || (neighbours.length > 3));
} else {
// produce new live cell with average color
if (neighbours.length == 3) {
newCell.live = true;
newCell.color = averageColor(neighbours, matrixPrev);
}
}
}
return matrixNew;
}
```
2. Conway Game of Life core functionality was correctly implemented.
3. Concurrent issue is avoided as NodeJS is Single Thread Engine, and all the modification is done in synchronized pattern
4. Colors are averaged whenever neighbouring cells of a different color interact.

### API and Service Design
#### Summary: Application lacks of modularity.
1. Backend has two program files: index.js and game.js, lacks of modularity.
2. Network APIs and logics are implemented in game.js.
3. Lacks of error handling.
4. Well documented README file.
5. README addresses that delivery speed is the first concern.
### Testing, CI/CD, and Site Reliability
#### Summary: Simple unit test, covers most crucial and hard-to-debug algorithms. Lacking integration tests and multiplayer tests.
1. Use of industry-standard testing frameworks i.e. Jest
2. Covers most crucial and hard-to-debug algorithms, e.g. color averaging, find neighbors.
3. No full-stack integration tests were implemented probably due to the time constraint.
4. There are no tests for the client side as a majority of the logic is implement on the server-side.
5. Instance where multi-player does not assign different colors:
6. Tests passed as shown by the screenshot below:

### UX Design and Prototyping
#### Summary: UI is intuitive.
1. UI is intuitive to use.
2. Multiplayer mode seems to work correctly at times and each player has a different color.

3. It is possible to add random cells, but due to the fast generation cycle it is hard to form a particular pattern. This can be fixed by increasing the time between each generation.
4. Grid container size is fixed and does not alter shape when browser is minimized.
5. Has pattern toolbar.
### Web Frontend
#### Summary: Use of jQuery to implement front-end.
1. Use of jQuery to implement front-end.
2. Socket.io is used for communication between server and client sides.
3. Use of ES6 syntax, no static code analysis via linting.
4. Libraries are included in HTML, no import syntax in JS.
5. Simple implementation, lacks of modularity.
## Assessment Grading
Terminal 1 assessment is 8 hours offline project. It serves as a screen to ensure the candidate is above a base level of competence. Every assessment tests essential skills required for a job. Terminal 1 uses wings to represent the level of a skill.
#### Skill Grading Levels
Terminal 1 assigns levels to each assessed skill, which could be interpreted as a seniority level.
| Level | Icon | Notes |
|---|---|---|
| 0 |  | No knowledge of the skill, everyone who attempts the challenge gets this level. |
| 1 |  | Basic knowledge of the skill, could be awarded via online course completion or certification. Would be the main skill for junior positions. |
| 2 |  | Good knowledge of the skill. Approximately 200-800 hours dedicated directly to the skill mastering or 3-5 years of job experience. Only 10% of people get to this level. |
| 3 |  | Senior/Lead level with typically 5-10 years of experience. This is a high mark achieved by 3% of people. |
#### Skill assessment criteria
Terminal 1 uses predefined criteria to qualify candidates for every skill level. A full list of grading criteria could be found in our [library](https://www.tty1.co/skills). Each skill is assessed by categories using A-F grading system, where C is a passing grade.
For example, to be awarded level 2 in "API and Service Design", a candidate needs to show the ability to 1) architect scalable solutions, including sync/async responses, web sockets, caching and 2) implement common API protocol in the assignment.
## Problem Statement
[Conway's Game of Life](https://en.wikipedia.org/wiki/Conway's_Game_of_Life) is a famous simulation that demonstrates cellular automaton. It is modeled as a grid with 4 simple rules:
1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
2. Any live cell with two or three live neighbours lives on to the next generation.
3. Any live cell with more than three live neighbours dies, as if by overcrowding.
4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Create a _multiplayer_ Web app version of Game of Life, with the following functions. You can assume all users use the latest version of Google Chrome browser.
1. Implement the Game of Life in browser. You can use any representation such as `<canvas>`, simple DOM manipulation or even `<table>` cells. The game should tick automatically at a predefined interval, at say, 1 step per second.
2. The browser connects to an HTTP server, written in Ruby or Node.js (can be any frameworks, e.g. Ruby on Rails, Sinatra, EventMachine, Hapi or just plain listening on a socket). This server allows _multiple_ browser to share the same, synchronized world view.
3. Each client is assigned a random color on initialization. From the browser, clicking on any grid will create a live cell on that grid with the client's color. This change should be synchronized across all connected clients. (You can use any mechanism to achieve this, such as polling, comet or WebSocket)
4. When a dead cell revives by rule #4 "Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.", it will be given a color that is the _average_ of its neighbours (that revive it).
5. To make the evolution more interesting, include a toolbar that places some predefined patterns at random places with the player's color, such as those found at here https://en.wikipedia.org/wiki/Conway's_Game_of_Life#Examples_of_patterns (not necessary to implement all, just 3 - 4 is fine).