{"id":19595959,"url":"https://github.com/innovativeinventor/cgt","last_synced_at":"2025-11-19T18:04:07.681Z","repository":{"id":135191227,"uuid":"327804930","full_name":"InnovativeInventor/cgt","owner":"InnovativeInventor","description":"Calculating surreal numbers from combinatorial games","archived":false,"fork":false,"pushed_at":"2021-01-22T01:11:56.000Z","size":304,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-26T14:45:27.264Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TeX","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/InnovativeInventor.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,"publiccode":null,"codemeta":null}},"created_at":"2021-01-08T05:11:47.000Z","updated_at":"2021-02-13T04:48:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3a6f7db-78ce-45e4-8aa9-93729182c0d0","html_url":"https://github.com/InnovativeInventor/cgt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/InnovativeInventor/cgt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fcgt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fcgt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fcgt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fcgt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InnovativeInventor","download_url":"https://codeload.github.com/InnovativeInventor/cgt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fcgt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285299210,"owners_count":27148082,"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-11-19T02:00:05.673Z","response_time":65,"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-11-11T08:49:44.120Z","updated_at":"2025-11-19T18:04:07.662Z","avatar_url":"https://github.com/InnovativeInventor.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Combinatorial game theory\n![Tests](https://github.com/InnovativeInventor/cgt/workflows/Tests/badge.svg)\n\nGeneralized deterministic recursive/dynamic combinatorial game theory calculator for evaluating the state of any two-person game that has a corresponding number.\nOnly uses vanilla python and pydantic (for type-checking).\n\nRationale:\n\u003e The best way to understand a process is to write a program automating it.\n\n## Example game (Push)\n```python\nfrom cgt.game import GameTree\nfrom cgt.pushpin import PushGame\n\ncase = PushGame([\"\", \"L\", \"R\"])\nprint(GameTree(case).value())\n```\n\nOutput:\n``` python\n\u003e\u003e\u003e -1.75\n```\n\n## Implementing your own game\n```python\nclass AbstractGame():\n    \"\"\"\n    Example of required methods and functions that must be implemented\n    \"\"\"\n    def __init__(self, state: AbstractState = AbstractState()): # some state to pass to the game\n        raise NotImplementedError\n\n    def moves(self) -\u003e List[Set[AbstractState]]: # return a list of a set of moves for each player\n        \"\"\"\n        Returns the possible moves left. If there are no moves left, return empty lists.\n        \"\"\"\n        raise NotImplementedError\n\n    def apply(self, state: AbstractState): # takes a state and applies it to the game\n        \"\"\"\n        Apply a move or \"state\" return by moves.\n        \"\"\"\n        raise NotImplementedError\n\n    @staticmethod\n    def prune_states(self, state: AbstractState) -\u003e AbstractState:\n        \"\"\"\n        Normalizes the state\n        \"\"\"\n        raise NotImplementedError\n```\n\nFor a real-live working example, see [`cgt/push.py`](/cgt/push.py)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fcgt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnovativeinventor%2Fcgt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fcgt/lists"}