{"id":49041623,"url":"https://github.com/echecsjs/direct-encounter","last_synced_at":"2026-04-19T15:01:01.572Z","repository":{"id":346404600,"uuid":"1189825959","full_name":"echecsjs/direct-encounter","owner":"echecsjs","description":"Direct encounter tiebreak for chess tournaments following FIDE rules. Zero dependencies.","archived":false,"fork":false,"pushed_at":"2026-04-12T10:28:39.000Z","size":121,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T11:28:24.723Z","etag":null,"topics":["chess","fide","tiebreak","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/mormubis/direct-encounter#readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/echecsjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-23T17:50:16.000Z","updated_at":"2026-04-12T10:36:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/echecsjs/direct-encounter","commit_stats":null,"previous_names":["mormubis/direct-encounter","echecsjs/direct-encounter"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/echecsjs/direct-encounter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echecsjs%2Fdirect-encounter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echecsjs%2Fdirect-encounter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echecsjs%2Fdirect-encounter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echecsjs%2Fdirect-encounter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/echecsjs","download_url":"https://codeload.github.com/echecsjs/direct-encounter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echecsjs%2Fdirect-encounter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32010957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["chess","fide","tiebreak","typescript"],"created_at":"2026-04-19T15:00:38.753Z","updated_at":"2026-04-19T15:01:01.566Z","avatar_url":"https://github.com/echecsjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Direct Encounter\n\n[![npm](https://img.shields.io/npm/v/@echecs/direct-encounter)](https://www.npmjs.com/package/@echecs/direct-encounter)\n[![Coverage](https://codecov.io/gh/echecsjs/direct-encounter/branch/main/graph/badge.svg)](https://codecov.io/gh/echecsjs/direct-encounter)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n**Direct Encounter** is a TypeScript library implementing the Direct Encounter\ntiebreak for chess tournaments, following the\n[FIDE Tiebreak Regulations](https://handbook.fide.com/chapter/TieBreakRegulations032026)\n(section 6). Zero runtime dependencies.\n\n## Installation\n\n```bash\nnpm install @echecs/direct-encounter\n```\n\n## Quick Start\n\n```typescript\nimport { directEncounter } from '@echecs/direct-encounter';\nimport type { Game, GameKind, Player } from '@echecs/direct-encounter';\n\n// Players A, B, C are tied on points\nconst players = [{ id: 'A' }, { id: 'B' }, { id: 'C' }];\n// games[n] = round n+1; Game has no `round` field\nconst games: Game[][] = [\n  [{ black: 'B', result: 1, white: 'A' }], // round 1\n  [{ black: 'C', result: 0.5, white: 'A' }], // round 2\n  [{ black: 'C', result: 0, white: 'B' }], // round 3\n];\n\nconst score = directEncounter('A', games, players);\n// Returns A's score from games played against other tied players (B and C)\n```\n\n## API\n\n### `directEncounter(playerId, games, players)`\n\n**FIDE section 6** — Direct Encounter score. Returns the total points scored by\n`playerId` in games played only against other players in the `players` array\n(the tied group). The caller is responsible for passing the correct subset of\n`players` — typically those who share the same tournament score as `playerId`.\nByes are excluded. Round is determined by array position: `games[0]` = round 1,\n`games[1]` = round 2, etc. The `Game` type has no `round` field. The optional\n`kind?: GameKind` field identifies unplayed rounds; byes are excluded from\nDirect Encounter regardless.\n\n```typescript\ndirectEncounter(playerId: string, games: Game[][], players: Player[]): number\n```\n\nAlso exported as `tiebreak` — an alias for `directEncounter`:\n\n```typescript\nimport { tiebreak } from '@echecs/direct-encounter';\n```\n\nWhen all tied players have identical Direct Encounter scores (the common case in\nSwiss), this tiebreak is inconclusive and the next tiebreak in the ordering\nshould be applied.\n\n### Types\n\n```typescript\nimport type { Game, GameKind, Player, Result } from '@echecs/direct-encounter';\n```\n\n| Type       | Shape / Values                                                                               |\n| ---------- | -------------------------------------------------------------------------------------------- |\n| `Player`   | `{ id: string }`                                                                             |\n| `Result`   | `0 \\| 0.5 \\| 1`                                                                              |\n| `Game`     | `{ black: string; white: string; result: Result; kind?: GameKind }`                          |\n| `GameKind` | `'forfeit-loss' \\| 'forfeit-win' \\| 'full-bye' \\| 'half-bye' \\| 'pairing-bye' \\| 'zero-bye'` |\n\n## Contributing\n\nContributions are welcome. Please open an issue at\n[github.com/echecsjs/direct-encounter/issues](https://github.com/echecsjs/direct-encounter/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechecsjs%2Fdirect-encounter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fechecsjs%2Fdirect-encounter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechecsjs%2Fdirect-encounter/lists"}