{"id":27073094,"url":"https://github.com/kh3rld/prisoners-dilemma","last_synced_at":"2025-04-05T23:35:35.847Z","repository":{"id":252512113,"uuid":"840657208","full_name":"kh3rld/prisoners-dilemma","owner":"kh3rld","description":"The Prisoner's Dilemma Game is a strategic game built with Go, allowing players to explore the classic game theory problem.","archived":false,"fork":false,"pushed_at":"2024-09-16T06:15:32.000Z","size":115,"stargazers_count":5,"open_issues_count":14,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-16T19:27:40.169Z","etag":null,"topics":["cli","game","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kh3rld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-10T09:33:06.000Z","updated_at":"2024-09-15T20:36:27.000Z","dependencies_parsed_at":"2024-08-10T11:21:43.365Z","dependency_job_id":"d6eb5a1b-a1e4-44ec-bb96-de44c0a6a628","html_url":"https://github.com/kh3rld/prisoners-dilemma","commit_stats":null,"previous_names":["kh3rld/prisoners-dilemma"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Fprisoners-dilemma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Fprisoners-dilemma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Fprisoners-dilemma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Fprisoners-dilemma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kh3rld","download_url":"https://codeload.github.com/kh3rld/prisoners-dilemma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415807,"owners_count":20935384,"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":["cli","game","golang"],"created_at":"2025-04-05T23:35:35.112Z","updated_at":"2025-04-05T23:35:35.833Z","avatar_url":"https://github.com/kh3rld.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prisoner's Dilemma Game\n\n## Overview\n\nThe **Prisoner's Dilemma Game** is a strategic [game](https://en.wikipedia.org/wiki/Prisoner%27s_dilemma) built with Go, allowing players to explore the classic game theory problem. Players can compete against each other either locally or over a network, choosing between cooperation or defection in each round. The outcome of each decision impacts their \"prison time,\" with the goal of minimizing their own time.\n\n## Features\n\n- **Local and Network Play**: Choose to play against another player on the same machine or over the network.\n- **Multiple Rounds**: Customize the number of rounds and view summaries after the game.\n- **AI Opponent**: Play against different AI strategies like Tit-for-Tat or Random (future release).\n- **Futuristic UI**: Experience a sleek, animated interface with cool ASCII art and a modern design (future release).\n\n## Getting Started\n\n### Prerequisites\n\n- Go 1.20 or higher\n- A terminal or command line interface\n\n### Installation\n\n1. **Clone the repository**:\n    ```bash\n    git clone https://github.com/kh3rld/prisoners-dilemma.git\n    ```\n2. **Navigate to the project directory**:\n    ```bash\n    cd prisoners-dilemma\n    ```\n3. **Initialize the Go module**:\n   ```go\n   go mod init github.com/kh3rld/prisoners-dilemma\n   ```\n4. **Tidy up the dependencies**:\n   ```go\n   go mod tidy\n   ```\n5. **Build the project**:\n    ```go\n    cd ./cmd \u0026\u0026 go build .\n    ```\n6. **Run the game**:\n    ```bash\n    ./cmd\n    ```\n\n### Usage\n\nWhen you start the game, you'll be presented with a menu:\n\n- **1. Play Locally**: Start a local game between two players on the same machine.\n- **2. Play Over Network**: Host or join a game over the network.\n- **3. View Instructions**: Learn how to play the game.\n- **4. Quit**: Exit the game.\n\nFollow the prompts to enter your choices and enjoy the game!\n\n### Playing Over Network\n\nTo play over the network:\n\n1. **Host a Game**: Select \"Host a Game\" on one machine and wait for the other player to join.\n2. **Join a Game**: Select \"Join a Game\" on the second machine and enter the host’s IP address.\n\n### Game Rules\n\n1. Each player can choose to **cooperate** or **defect**.\n2. If both players cooperate, they each get **1 year** in prison.\n3. If one defects while the other cooperates, the defector goes free and the cooperator gets **3 years** in prison.\n4. If both defect, they each get **2 years** in prison.\n5. The goal is to minimize your prison time over multiple rounds.\n\n## Contributing\n\nWe welcome contributions! Please fork the repository and submit a pull request with your improvements. \n\n### Future Enhancements\n\n- Add AI opponents with different strategies.\n- Implement a leaderboard for networked games.\n- Enhance the user interface with more animations and effects.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Special thanks to the Go community and open-source contributors.\n- Inspired by the classic game theory problem, the **Prisoner's Dilemma**.\n\n## Contact\n\nFeel free to reach out via [X](https://x.com/kh3rld) or [GitHub](https://github.com/kh3rld) for any questions or feedback.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh3rld%2Fprisoners-dilemma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkh3rld%2Fprisoners-dilemma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh3rld%2Fprisoners-dilemma/lists"}