{"id":20245709,"url":"https://github.com/skytecat/gametheory","last_synced_at":"2025-07-15T04:34:06.633Z","repository":{"id":257728393,"uuid":"859148521","full_name":"skytecat/GameTheory","owner":"skytecat","description":"Simulation of a \"Prisoner's Dilemma\" in the Python programming language","archived":false,"fork":false,"pushed_at":"2024-09-21T06:01:17.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T15:47:02.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/skytecat.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":"2024-09-18T07:06:16.000Z","updated_at":"2024-09-21T06:01:21.000Z","dependencies_parsed_at":"2025-03-03T15:40:55.536Z","dependency_job_id":"de9289c0-0a60-42cc-a707-0b0b6f415a78","html_url":"https://github.com/skytecat/GameTheory","commit_stats":null,"previous_names":["skytecat/gametheory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skytecat/GameTheory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skytecat%2FGameTheory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skytecat%2FGameTheory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skytecat%2FGameTheory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skytecat%2FGameTheory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skytecat","download_url":"https://codeload.github.com/skytecat/GameTheory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skytecat%2FGameTheory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265402833,"owners_count":23759237,"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","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-14T09:23:28.504Z","updated_at":"2025-07-15T04:34:06.611Z","avatar_url":"https://github.com/skytecat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GameTheory\n## Prisoner's Dilemma\n\n[Описание на русском](./README_RUS.md)\n\nThis project simulates the simple game with candy, where there is a machine that\ncontrols the supply of candy for two groups of people based on whether \none or both of two operators put one in it:\n\n|  | Both cooperate | 1 cheats, 2 cooperates | 1 cooperates, 2 cheats | Both cheat |\n|------------|----------|----------|----------|---------|\n| Operator 1 | +2 candy | +3 candy | -1 candy | 0 candy |\n| Operator 2 | +2 candy | -1 candy | +3 candy | 0 candy |\n\nSo, if everyone is cooperating and puts candy in a machine as agreed,\neveryone gets a reward. But both participants also have a temptation to\ncheat and only pretend to put a candy into machine, because in this case\ntheir group will get 3 candy back, just taking one candy from a second\ngroup. The problem is, if both operators decide to play dirty, then nobody\nwill get anything.\n\n## Behavior types\n\nThis project uses 5 models of behavior:\n\n| Behavior type | Player Actions                                                                                                                                                                                         |\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Cheater       | Always cheats                                                                                                                                                                                          |\n| Cooperator    | Always cooperates                                                                                                                                                                                      |\n| Copycat       | Starts with cooperating, but then just repeats whatever the other guy is doing                                                                                                                         |\n| Grudger       | Starts by always cooperating, but switches to Cheater forever if another guy cheats even once                                                                                                          |\n| Detective     | First four times goes with [Cooperate, Cheat, Cooperate, Cooperate],  and if during these four turns another guy cheats even once -  switches into a Copycat. Otherwise, switches into Cheater himself |\n\n-----\n\n## Project Requirments\n\nNeed to model a system with seven\nclasses - `Game`, `Player` and five behavior types (subclassed from `Player`).\n\nHere, `registry` is used to keep track of the current number of candy\nduring the game, while `player1` and `player2` are instances of \nsubclasses of `Player` (each being one of 5 behavior types). Calling \n`play()` method of a `Game` instance should perform a simulation\nof a specified number of matches between players of a given behavior.\n\nMethod `top3()` should print current top three player's behaviors\nalong with their current score.\n\nBy default, code when run should simulate 10 matches (one call of\n`play()`) between every pair of two players with *different* behavior\ntypes (total 10 rounds by 10 matches each, no matches between two\ncopies of the same behavior) and print top three winners after the \nwhole game.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskytecat%2Fgametheory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskytecat%2Fgametheory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskytecat%2Fgametheory/lists"}