{"id":15772615,"url":"https://github.com/d2phap/knockout-tournament","last_synced_at":"2025-08-02T09:36:13.448Z","repository":{"id":151064406,"uuid":"81094049","full_name":"d2phap/Knockout-Tournament","owner":"d2phap","description":"Knockout tournament","archived":false,"fork":false,"pushed_at":"2017-02-13T12:14:43.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-05T15:40:47.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d2phap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-02-06T14:13:36.000Z","updated_at":"2020-03-16T14:48:41.000Z","dependencies_parsed_at":"2024-02-22T04:31:49.522Z","dependency_job_id":null,"html_url":"https://github.com/d2phap/Knockout-Tournament","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/d2phap/Knockout-Tournament","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2phap%2FKnockout-Tournament","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2phap%2FKnockout-Tournament/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2phap%2FKnockout-Tournament/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2phap%2FKnockout-Tournament/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d2phap","download_url":"https://codeload.github.com/d2phap/Knockout-Tournament/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2phap%2FKnockout-Tournament/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268363005,"owners_count":24238546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T15:40:58.137Z","updated_at":"2025-08-02T09:36:13.426Z","avatar_url":"https://github.com/d2phap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knockout Tournament\n\nThe goal of this task is to simulate a single-elimination knockout tournament in the browser, determining the winner as quickly as possible.\n\nWe expect this task will take around 5 hours.\n\nThe simulation must implement the following flow:\n\n1. The user enters the number of teams participating in the tournament (a non-zero power of the `TEAMS_PER_MATCH` constant).\n2. The user clicks the start button.\n3. The first round's match-ups are fetched from the server.\n4. The winner of a match moves on to the next round and matches up against the adjacent winner(s).\n5. Matches are simulated until the winning team is determined.\n6. The winning team's name is shown in the UI.\n\nBoth teams and matches have scores that are constant for the duration of the tournament. To simulate a match:\n\n1. The teams' scores are fetched from the server.\n2. The match's score is fetched from the server.\n3. All these scores are sent to the server and it returns the winning team's score.\n4. In the event of a tie, the team with the lowest ID wins.\n\n### UI Requirements\nPlease implement the simple UI wireframes outlined below. Minimal styling is acceptable.\n\nDisplay a square for each match. Completed matches should be filled with a solid colour.\n```\n■ ■ ■ □ □ □ □\n```\n\nWhen the winner is determined, display it above the squares.\n\n```\nKillara Quokkas is the Winner.\n\n■ ■ ■ ■ ■ ■ ■\n```\n\n## Constraints\n\nYou may:\n\n- Develop only for Chrome\n- Use any feature available in the latest stable release of Chrome\n- Edit `/etc/hosts`\n\nYou must not:\n\n- Hard code the number of teams per match — respect the `TEAMS_PER_MATCH` constant in `shared/config.js`\n- Modify the server or integration tests\n- Modify/remove the `#numberOfTeams`, `#start`, or `#winner` elements\n- Submit your solution if the test suite is failing\n- Use any build tools other than npm (Browserify, webpack, etc.)\n- Use any frameworks or libraries (Angular, jQuery, React, etc.)\n\n## Marking Criteria\n\nYour code should be clear and easy to understand:\n\n- Avoids unnecessary complexity / over-engineering\n- Brief comments are added where appropriate\n- Broken into logical chunks\n- Follows a module pattern\n\nYour code should be performant:\n\n- Gives feedback to the user as soon as possible (perceived performance)\n- Intelligently coordinates dependent asynchronous tasks\n- UI remains responsive\n\nYour code should be testable (but writing tests isn't necessary):\n\n- Application and bootstrap code is split into separate files\n- Class-based architecture (ES6 classes preferred)\n- Dependency injection (the design pattern, not a framework or library)\n- No singletons or static mutable state \n\n## Running\n\n```\n// Node v6+ required\nnpm install\nnpm start # Starts the server on port 8765\nnpm test # Runs the test suite\n```\n\n## Server API\n\n### `GET /`\n\nServes `index.html`.\n\n### `GET /client/*`\n\nServes resources from the `client` directory.\n\n### `GET /shared/*`\n\nServes resources from the `shared` directory.\n\n### `POST /tournament`\n\nCreates a tournament and gets the first round's matches.\n\n\n#### Parameters\n| Name            | Type     | Description                                          |\n|:----------------|:---------|:-----------------------------------------------------|\n| `numberOfTeams` | `number` | Number of teams in the tournament you want to create |\n\n```\n$ curl -d numberOfTeams=4 http://localhost:8765/tournament\n{\n  tournamentId: 0,\n  matchUps: [{\n    match: 0,\n    teamIds: [0, 1]\n  }, {\n    match: 1,\n    teamIds: [2, 3]\n  }]\n}\n```\n\n### `GET /team`\n\nGets team data.\n\n#### Query Parameters\n| Name           | Type     | Description  |\n|:---------------|:---------|:-------------|\n| `tournamentId` | `number` | TournamentID |\n| `teamId`       | `number` | Team ID      |\n\n```\n$ curl http://localhost:8765/team?tournamentId=0\u0026teamId=0\n{\n  teamId: 0,\n  name: \"Camden Wombats\",\n  score: 8\n}\n```\n\n### `GET /match`\n\nGets match data.\n\n#### Query Parameters\n| Name           | Type     | Description                         |\n|:---------------|:---------|:------------------------------------|\n| `tournamentId` | `number` | Tournament ID                       |\n| `round`        | `number` | Round of the tournament (0-indexed) |\n| `match`        | `number` | Match of the round (0-indexed)      |\n\n\n```\n$ curl http://localhost:8765/match?tournamentId=0\u0026round=0\u0026match=0\n{\n  score: 67\n}\n```\n\n### `GET /winner`\n\nGets the winning score of a match.\n\n#### Query Parameters\n| Name           | Type            | Description                      |\n|:---------------|:----------------|:---------------------------------|\n| `tournamentId` | `number`        | Tournament ID                    |\n| `teamScores`   | `Array\u003cnumber\u003e` | Team scores                      |\n| `matchScore`   | `number`        | Score for the match being played |\n\n```\n$ curl http://localhost:8765/winner?tournamentId=0\u0026teamScores=8\u0026teamScores=9\u0026matchScore=67\n{\n  score: 9\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd2phap%2Fknockout-tournament","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd2phap%2Fknockout-tournament","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd2phap%2Fknockout-tournament/lists"}