Skip to content

Instantly share code, notes, and snippets.

@tamarr
Last active December 23, 2021 12:38
Show Gist options
  • Save tamarr/1af8e628811781e49a4d205e872700d7 to your computer and use it in GitHub Desktop.
Save tamarr/1af8e628811781e49a4d205e872700d7 to your computer and use it in GitHub Desktop.

Background:

Team Fnatic and Team Liquid are long time rivals in the CS:GO tournaments. Both teams qualified for the finals in the ESL Pro League 2021. Team Fnatic is Edge’s preferred and strategic customer/ partner. Along the usual training by Edge, we have decided to aid with calculating and portraying their skills and performance in the training sessions.

Edge’s most talented technology department took on this challenge.

Your mission, dear potential colleague, is to implement a backend to support game session analysis. You will create a REASTful API and design a database model to store and show the results.

Input:

  1. Each player, during a training session (or even a competitive game), makes a lot of moves and decisions = Measurements. The input of the CREATE function you will write is an array of measurement hashes as well as a game session name and player name.
  2. For each measurement entry calculate a grade based on the criteria listed below. In addition combine all similar measurement type entries (such as move) into an average creating an accumulated measurement type value. Different measurement types are combined to create a Skill. A Skill accumulated value is calculated based on a combination of the accumulated values of the different measurement types. More specifically, it is the weighted average of the different measurement types values (examples follow).
  3. The Skills for the assignment are Speed and Accuracy.
  4. Speed’s measurement types are: Move - The time of a mouse movement from mid screen to a target (value in miliSeconds int) – Can happen several times in a session. Bomb - The total time it took to implant a bomb – Can happen only once at the most (value in boolean).
  5. Accuracy’s measurement types are: Misses - The distance of a shot from a target’s head (value in pixels int) – Can happen several times in a session. Headshot – A direct hit in the head of a target (value in boolean) - Can happen several times in a session. Body hit - A direct hit in the body of a target (value in boolean) - Can happen several times in a session
  6. Here is an example of an input:
{
  game_session_name: 'epic battle',
  player_name: 'fargon',
  measurements: [
    {time: 40, type: 'Move', value: 65},
    {time: 40, type: 'Misses', value: 105},
    {time: 100, type: 'Misses', value: 50},
    {time: 120, type: 'Move', value: 105},
    {time: 140, type: 'Move', value: 90},
    {time: 160, type: 'Headshot', value: true},
    {time: 280, type: 'Move', value: 400},
    {time: 280, type: 'Misses', value: 55},
    {time: 600, type: 'Misses', value: 110},
    {time: 900, type: 'Misses', value: 88},
    {time: 1260, type: 'Body', value: true},
    {time: 10080, type: 'Move', value: 44},
    {time: 10500, type: 'Misses', value: 222},
    {time: 10600, type: 'Misses', value: 99},
    {time: 10700, type: 'Move', value: 300},
    {time: 12600, type: 'Body', value: true},
    {time: 16780, type: 'Misses', value: 50},
    {time: 21000, type: 'Body', value: true},
    {time: 27000, type: 'Misses', value: 8},
    {time: 27060, type: 'Misses', value: 510},
    {time: 27160, type: 'Move', value: 140},
    {time: 27480, type: 'Move', value: 200},
    {time: 27900, type: 'Misses', value: 99},
    {time: 27980, type: 'Body', value: true},
    {time: 28500, type: 'Headshot', value: true},
    {time: 29000, type: 'Bomb', value: true},
  ]
}

Grade:

  1. Move – 100 if value is less than 105. 70 if value is between 105 and 250. 0 if value is larger than 250.
  2. Bomb - 100 if time is less than 40000 mSec. Else – 0.
  3. Misses - 100 if value is less than 60. 70 if value is between 60 and 400. 0 if value is more than 400.
  4. Headshot – 100 if true.
  5. Body hit - 80 if true.

Accumulated scores Each skill gets a final score, based on its accumulated measurements. Remember that each measurement type has its own weight. The accumulation of a skill is the weighted average of the different measurements. For example if the average moves is 64 and the average bomb is 50, Speed’s final grade could be 70% of average moves and 30% of average bomb: 64\*0.7 + 50\*0.3 = 59.8. Feel free to define the weights value.

Output:

  1. Project - create a full project, either Ruby on Rails or Node.js, that can be easily installed and run locally.
  2. Router \ Controller - create RESTful API endpoints for creating, listing and showing game sessions. Create (POST) takes in the input, calculates the measurements' grades and accumulated scores, stores the information in the database and returns the game session id. List (GET) returns the list of game sessions (name and id). Show (GET w/ id) returns a game session by id. You can implement update (PUT) as a bonus but it is not necessary.
  3. Database – design a game session record with date created, game session name, and player name, as well as the accumulated speed and accuracy scores. Define a measurement record with the measurement's input values as well as the calculated score. Each game session should have many measurements. Describe your database design in a document or flow chart in a consice and coherent way. For run and testing purposes you can generate a document with static results to return from Show.
  4. Documentation - add documentation describing your work and how to run the service.
  5. BONUS: Tests - write tests to ensure the validity of you code.

Important notes:

  1. We evaluate the assignment as we would a PR and documentation - code that is about to be merged into production and documentation that should help others build and maintain a system. Thus we prioritize readablity and maintainablity over features. Please keep you solution simple and easy to follow.
  2. Please do not submit your solution as a comment. Instead create a public gist or repo, or send us a zipped folder.

Time Frame for the Sprint:
Pls Deliver your work within a 3 day period.

Good luck. We are available for questions and clarifications.

Edge Gaming Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment