Skip to content

Instantly share code, notes, and snippets.

@tamarr
Last active May 26, 2021 23:32
Show Gist options
  • Save tamarr/ccafdf03d1318d44ec4635bb004832a4 to your computer and use it in GitHub Desktop.
Save tamarr/ccafdf03d1318d44ec4635bb004832a4 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 a gathering data regarding 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 function that takes information from the currently running game and sends calculated events to the server.

Input:

  1. Each player encounters enemies in their field of view throughout their gameplay. The input for the function you will write is an enemy object, containing their coordinates on the screen, and the viewport coordinates.

  2. Enemy objects contain the following fields: x (character start from left of scene), width, y (character start from bottom), height.

  3. Viewport objects contain the following field: x (view start from left of scene - note that scene might be wider). It also contains a static parameter defining a fixed width and fixed height. Height is always from top to bottom, while the viewport moves along the x axis, it is always of a fixed width and height.

  4. Here’s an example of the input:

    Enemy1 {x: 50, width: 7, y: 11, height: 23}

    Viewport {x: 23, fixed_width: 100, fixed_height: 100}

Events:

  1. EMPTY: the enemy is not inside the viewport.
  2. VISIBLE: the enemy is in the viewport, add payload of shortest pixels distance from screen center to enemy - 0 if screen center is on any part of the enemy.
  3. HEAD: In addition to VISIBLE send another event if the center is on the top 1/8 of the enemy.

Output:

Send events to ‘localhost:8080/edge/events’. Return true if POST "succeeded", false otherwise (no need to implement the actual server).

Deliverables:

  1. Create the necessary structures for Enemy and Viewport.
  2. Create a function that takes in an enemy and viewport objects and sends the events as described.
  3. Bonus (Extra Credit): Add tests.
  4. Please do not create a full project, a single file containing the function and any other information you deem important.
  5. Please do not submit your solution as a comment. Instead create a fork and create your solution as a single file on your fork.

Time Frame for the Sprint:
Pls Deliver your work within a 7 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