{"id":16162530,"url":"https://github.com/sunsided/autobattler","last_synced_at":"2025-04-07T03:48:25.941Z","repository":{"id":165350775,"uuid":"640641231","full_name":"sunsided/autobattler","owner":"sunsided","description":"A toy project for experimenting with strategies in a turn-based combat game.","archived":false,"fork":false,"pushed_at":"2023-10-19T20:13:00.000Z","size":204,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T08:28:41.224Z","etag":null,"topics":["alpha-beta-pruning","artificial-intelligence","game-theory","minimax","planning","rpg","rust","turn-based","turn-based-combat"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/sunsided.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}},"created_at":"2023-05-14T18:51:41.000Z","updated_at":"2024-05-09T19:11:58.000Z","dependencies_parsed_at":"2023-11-28T15:07:57.397Z","dependency_job_id":null,"html_url":"https://github.com/sunsided/autobattler","commit_stats":{"total_commits":40,"total_committers":2,"mean_commits":20.0,"dds":"0.025000000000000022","last_synced_commit":"ec7fd6f1b93e3830e86c8d4f14f0e09649781671"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fautobattler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fautobattler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fautobattler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fautobattler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/autobattler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589835,"owners_count":20963022,"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":["alpha-beta-pruning","artificial-intelligence","game-theory","minimax","planning","rpg","rust","turn-based","turn-based-combat"],"created_at":"2024-10-10T02:30:39.947Z","updated_at":"2025-04-07T03:48:25.921Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Turn-based Auto-battling Experiments\n\nThis is a toy project for experimenting with game strategies in a turn-based combat,\nakin to fights in role-playing games like Might \u0026 Magic 3/4/5, Eye of the Beholder,\nBard's Tale, etc.\n\n... with the twist of having ✨Artificial✨Intelligence✨ select your turns.\n\n---\n\nThis is definitely not rocket science being done here. Expect more minimax than AlphaZero.\n\n## Example outcome\n\nThe following is an example of how it may unfold.\n\nWe see the hero party, consisting of _Brull_, as well as the enemy party, consisting of _Ziuon_ and _Molphige_. \n_Ziuon_ deals only 5 damage with their stick, but _Molphige_ deals 20 with their fists, which will take\n_Brull_ out in one hit. Regardless of _Molphige_ being the third one to move, the only viable option is\nfor _Brull_ to attack _Molphige_ first to ensure they can never make a move to begin with.\n\nThat is indeed what happens:\n\n```\nPerformed 921 evaluations with 221 cuts at depth 8 in 309.766µs. The encounter has 5 turns.\nTL;DR: The initiating party wins with a score of 10.\n\nOn the attacking side:\n- Brull, with 20 health and their fists (10 damage)\n\nOn the defending side:\n- Ziuon, with 15 health and a stick (5 damage)\n- Molphige, with 10 health and their fists (20 damage)\n\nTurn 1 (discovered at step 1):\n  Brull whacks Molphige with their fists, dealing 10 damage\n   ⇒ Molphige has given up on being alive\n\nTurn 2 (discovered at step 2):\n  Ziuon whacks Brull with a stick, dealing 5 damage\n   ⇒ Brull now has 15 health\n\nTurn 3 (discovered at step 3):\n  Brull whacks Ziuon with their fists, dealing 10 damage\n   ⇒ Ziuon now has 5 health\n\nTurn 4 (discovered at step 4):\n  Ziuon whacks Brull with a stick, dealing 5 damage\n   ⇒ Brull now has 10 health\n\nTurn 5 (discovered at step 5):\n  Brull whacks Ziuon with their fists, dealing 10 damage\n   ⇒ Ziuon has given up on being alive\n```\n\nIf retreats are allowed for the enemy party, the game has a different outcome: The enemy\nnow decides to flee at their first chance. The hero party still gets an extra move, but it is not\nenough to result in a defeat of the enemy.\n\n```\nPerformed 1063 evaluations with 247 cuts at depth 8 in 360.599µs. The encounter has 3 turns.\nTL;DR: The initiating party let the opponent flee with a score of 2.\n\nOn the attacking side:\n- Brull, with 20 health and their fists (10 damage)\n\nOn the defending side:\n- Ziuon, with 15 health and a stick (5 damage)\n- Molphige, with 10 health and their fists (20 damage)\n\nTurn 1 (discovered at step 1):\n  Brull whacks Molphige with their fists, dealing 10 damage\n   ⇒ Molphige has given up on being alive\n\nTurn 2 (discovered at step 2):\n  the party flees\n\nTurn 3 (discovered at step 3):\n  Brull whacks Ziuon with their fists, dealing 10 damage\n   ⇒ Ziuon now has 5 health\n```\n\n## Rules of ~~Engagement~~ the Game\n\n- [x] Two factions are fighting each other and take turns in making moves.\n- Within each faction, a party of one or more participants\n  is allowed to make a move. Such an action can be,\n  - [x] Attacking a single opponent,\n  - [ ] Attacking a group of opponents (area effects),\n  - [ ] Applying an effect to a party member,\n  - [ ] Skip the turn, i.e. do nothing.\n- In addition, the faction as a whole can flee.\n  - [x] If a faction flees, the opposing faction gets one last turn.\n- [ ] Party members can panic and either flee, be paralyzed or attack their own faction.\n \nAs for actions,\n\n- [x] Some actions are instantaneous (attacking an enemy),\n- [ ] Some actions take preparation (e.g. preparing a magic spell),\n- [ ] Some actions have requirements (e.g. a potion must exist to be used)\n\n## Things to do\n\n- [x] Regular minimax ([`src/solver.rs`](src/solver.rs)).\n- [x] Multiple turns per party ([`src/action_iterator.rs`](src/action_iterator.rs)).\n- [x] Implement Alpha-Beta pruning ([`src/value.rs`](src/value.rs)).\n- [x] Implement Iterative Deepening.\n- [ ] Implement A*-like heuristics.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fautobattler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Fautobattler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fautobattler/lists"}