{"id":22268014,"url":"https://github.com/coac/locm","last_synced_at":"2025-08-31T19:40:29.561Z","repository":{"id":80202811,"uuid":"191362235","full_name":"Coac/locm","owner":"Coac","description":"Winning bot of the Strategy Card Game AI Competition CEC 2019 and COG 2019","archived":false,"fork":false,"pushed_at":"2020-08-05T08:09:29.000Z","size":11,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T12:42:34.877Z","etag":null,"topics":["alpha-beta-pruning","card-game","legends-of-code-and-magic","locm","minimax"],"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/Coac.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}},"created_at":"2019-06-11T11:56:47.000Z","updated_at":"2022-06-15T15:27:53.000Z","dependencies_parsed_at":"2023-07-12T04:30:15.830Z","dependency_job_id":null,"html_url":"https://github.com/Coac/locm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Coac/locm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coac%2Flocm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coac%2Flocm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coac%2Flocm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coac%2Flocm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coac","download_url":"https://codeload.github.com/Coac/locm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coac%2Flocm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273032927,"owners_count":25034067,"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-08-31T02:00:09.071Z","response_time":79,"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":["alpha-beta-pruning","card-game","legends-of-code-and-magic","locm","minimax"],"created_at":"2024-12-03T11:10:16.377Z","updated_at":"2025-08-31T19:40:29.547Z","avatar_url":"https://github.com/Coac.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coac - Legends of Code and Magic \nMy winning bot for [Strategy Card Game AI Competition](https://github.com/acatai/Strategy-Card-Game-AI-Competition) [CEC 2019](https://legendsofcodeandmagic.com/CEC19/) and [COG 2019](https://legendsofcodeandmagic.com/COG19/) :trophy:\n\n\n## Building\n```$xslt\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n## Configuration\nIf running on a slow or already CPU loaded computer, the bot may timeout. \nYou can reduce `TIME_LIMIT`.\n\n## Strategy\n\n### Search\nMy AI bot is based on a minimax algorithm with alpha-beta pruning at a fixed depth.\nSince we can do multiple actions per player turn, the minimax algorithm is repeated until there are no more available actions.\n\nFor one turn, we compute the best actions using minimax. \nThen among these, we keep only the first action. \nThe action is executed in the simulation environment.\nWe repeat the minimax algorithm.\n\nFor the opponent simulation, only attack players and attack monsters are considered.\n\nThe bot actions should be determinist if it has time to compute the multiple minimaxes. \nIn most of the case, due to the small search depth, the bot gets enough time. \nIt uses a `TIME_LIMIT` in case of a very very wide tree (very rare) to securely outputs actions before time out.\n\n### Draft\nTo choose what card to pick between the three proposed, my bot will pick the one with the highest rank.\nThe bot uses 2 fixed ranking of [cards](https://jakubkowalski.tech/Projects/LOCM/cardlist.html) available in the game. \nThese ranking will be chosen at the start based on the player position if the bot plays first or not.\n\n\n### Evaluation function\n\nThe evaluation of the state of the game uses the following features: \n\n    card.defense\n    card.attack\n    card.ward\n    card.lethal\n    card.guard\n    card.passed\n    player.cardsToDraw\n    player.hp\n\nEach feature has an associated weight on it that was first hand-tuned. A genetic algorithm has then been used\nto search for the best weights.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoac%2Flocm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoac%2Flocm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoac%2Flocm/lists"}