{"id":31505665,"url":"https://github.com/seanwevans/damnati","last_synced_at":"2026-05-14T20:31:53.916Z","repository":{"id":314773638,"uuid":"1056703284","full_name":"seanwevans/Damnati","owner":"seanwevans","description":"A CUDA-accelerated iterated prisoner's dilemma arena","archived":false,"fork":false,"pushed_at":"2025-09-22T15:15:08.000Z","size":392,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T17:26:51.247Z","etag":null,"topics":["arena","cuda","iterated-prisoners-dilemma","prisoners-dilemma","tournament"],"latest_commit_sha":null,"homepage":"","language":"C++","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/seanwevans.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-14T16:28:48.000Z","updated_at":"2025-09-22T15:12:49.000Z","dependencies_parsed_at":"2025-09-14T18:37:19.255Z","dependency_job_id":"eb6a8d9d-ed2e-4a16-857b-dc0ec29433e6","html_url":"https://github.com/seanwevans/Damnati","commit_stats":null,"previous_names":["seanwevans/damnati"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seanwevans/Damnati","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FDamnati","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FDamnati/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FDamnati/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FDamnati/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanwevans","download_url":"https://codeload.github.com/seanwevans/Damnati/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FDamnati/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278063119,"owners_count":25923594,"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-10-02T02:00:08.890Z","response_time":67,"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":["arena","cuda","iterated-prisoners-dilemma","prisoners-dilemma","tournament"],"created_at":"2025-10-02T20:09:59.774Z","updated_at":"2026-05-14T20:31:53.904Z","avatar_url":"https://github.com/seanwevans.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Damnati\n\u003cimg width=\"256\" alt=\"Warm Flame Against Red Backdrop\" src=\"https://github.com/user-attachments/assets/a9f9aa3a-90f0-431e-8727-53fb3ab3277f\" /\u003e\n\nDamnati is a CUDA-accelerated tournament simulator for the Iterated Prisoner's Dilemma (IPD). It pits a population of strategies against each other, including classical IPD strategies and optional N-gram learning agents.\n\n## Features\n\n- Runs all pairwise matches between agents on the GPU.\n- Supports classic strategies such as **Tit for Tat**, **Grim**, **Pavlov**, and others.\n- Optional N-gram learners with adjustable depth, exploration rate, and forgiveness parameters.\n- Reports aggregate statistics and per-strategy performance after the tournament.\n\n## Building\n\nThe program requires the NVIDIA CUDA toolkit. Build the executable with `nvcc`:\n\n```bash\nnvcc -O3 -arch=sm_86 damnati.cu -o damnati\n```\n\n## Usage\n\nRun the simulator and adjust parameters using command line flags:\n\n```bash\n./damnati --agents 512 --rounds 200 --seed 42 --p-ngram 0.6 --depth 3 --epsilon 0.1 --gtft 0.1\n```\n\n### Options\n\n- `--agents N`   – number of agents in the population (default: 256)\n- `--rounds R`   – number of rounds per match (default: 200)\n- `--seed S`     – RNG seed (default: 1234567)\n- `--p-ngram F`  – fraction of agents using the N-gram strategy (default: 0.5)\n- `--depth D`    – N-gram history depth (default: 3, maximum: 15)\n- `--epsilon E`  – exploration rate for N-gram learners (default: 0.1)\n- `--gtft P`     – forgiveness probability for Generous Tit for Tat (default: 0.1)\n\nDepths above 15 are rejected to keep GPU memory allocations within practical\nlimits.\n\nPassing an unknown option will print the usage information and exit with a\nnon-zero status, so double-check flag names.\n\n\n## Output\n\nThe simulator prints summary statistics in JSON format, including average score, minimum and maximum scores, standard deviation, and per-strategy results. The configuration header now reports the probability used by **Generous Tit for Tat** as `\"gtft\"`. For example:\n\n```json\n{\"agents\":256,\"rounds\":200,\"p_ngram\":0.600,\"depth\":3,\"epsilon\":0.100,\"gtft\":0.100,\n \"avg_score\":1.234, \"min\":-10, \"max\":15, \"stdev\":2.468,\n \"by_strategy\":{...}}\n```\n\nThe top few agents and their scores are also listed.\n\n## Testing\n\nUnit tests use the [Catch2](https://github.com/catchorg/Catch2) framework and can be\ncompiled with `nvcc`. From the repository root run:\n\n```bash\nnvcc -std=c++17 tests/test_core.cu -o tests/test_core\nnvcc -std=c++17 tests/test_cli.cu -o tests/test_cli\n```\n\nExecute each binary to run the associated suite:\n\n```bash\n./tests/test_core\n./tests/test_cli\n```\n\n`test_core` exercises the strategy decision logic in `choose_action`, the payoff\naccumulation performed by `ngram_update`, and the 64-bit integer square root helper.\n`test_cli` verifies that command-line validation reports errors for malformed depth\nvalues and unknown options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanwevans%2Fdamnati","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanwevans%2Fdamnati","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanwevans%2Fdamnati/lists"}