{"id":18333112,"url":"https://github.com/xiaokang2022/chess","last_synced_at":"2025-04-06T03:34:08.042Z","repository":{"id":231869979,"uuid":"781619949","full_name":"Xiaokang2022/Chess","owner":"Xiaokang2022","description":"A Chinese chess program based on tkintertools and written in CPython 3.12 and MSVC C++ 20.","archived":false,"fork":false,"pushed_at":"2025-03-17T13:53:18.000Z","size":368,"stargazers_count":37,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T14:45:47.543Z","etag":null,"topics":["ai","algorithms","chess","python","tkinter","tkintertools"],"latest_commit_sha":null,"homepage":"https://xiaokang2022.blog.csdn.net/article/details/128852029","language":"Python","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/Xiaokang2022.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-04-03T18:17:24.000Z","updated_at":"2025-03-17T13:53:24.000Z","dependencies_parsed_at":"2024-04-06T13:24:17.538Z","dependency_job_id":"9fbe4ea0-90cd-4231-be3b-fa8d5bffd12d","html_url":"https://github.com/Xiaokang2022/Chess","commit_stats":null,"previous_names":["xiaokang2022/chess"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xiaokang2022%2FChess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xiaokang2022%2FChess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xiaokang2022%2FChess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xiaokang2022%2FChess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xiaokang2022","download_url":"https://codeload.github.com/Xiaokang2022/Chess/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430838,"owners_count":20937873,"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":["ai","algorithms","chess","python","tkinter","tkintertools"],"created_at":"2024-11-05T19:41:21.532Z","updated_at":"2025-04-06T03:34:03.028Z","avatar_url":"https://github.com/Xiaokang2022.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chess 🚀\n\nA Chinese chess program based on tkintertools and written in Python 3.12 and C++ 20.\n\n![](./preview.png)\n\nThis program is implemented using a mix of `tkinter` and `tkintertools` modules, [`tkintertools`](https://github.com/Xiaokang2022/tkintertools) is a third-party Python module that I developed on my own to beautify `tkinter` and provide some advanced features! 🎉\n\n\u003e [!NOTE]  \n\u003e Since the original program was written by me one year ago, the `tkintertools` module uses the test version, and the AI of the program was added later, and the previous code quality is relatively poor, please understand. 😅\n\n## Star History\n\n\u003ca href=\"https://star-history.com/#Xiaokang2022/Chess\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=Xiaokang2022/Chess\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=Xiaokang2022/Chess\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=Xiaokang2022/Chess\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n\n## How to use\n\n### Before use\n\n\u003e [!IMPORTANT]  \n\u003e Make sure your Python version is **3.12** or greater and C++ version is **20** or greater.\n\n### Choose the mode\n\nrun the `main.py` and choose a game mode you want.\n\nI've provided **4** modes, Three of them can be selected in \"新游戏\"，and \"残局挑战\" needs to be selected in the \"棋局库\".\n\n### One last step\n\nhave fun! 😁\n\n## Brief introduction\n\n### Base Features\n\n1. Two-player match\n2. Man-machine battles\n3. Endgame Challenge\n4. LAN connection\n\n### About the AI\n\nI've provided **2** AI algorithms, one of which also provides an implementation of C++20:\n\n1. **Minimum-Max search algorithm**\n    - Python: min_max_search.py\n2. **Alpha-beta pruning algorithm**\n    - Python: alpha_beta_search.py\n    - C++ (default):\n        * src: ./cpp/HelloWorld.cpp\n        * dll: ./PyDLL.dll\n\nYou can change them in the settings. By the way, default value of the search depth is 4.\n\n\u003e [!TIP]  \n\u003e Due to the smaller number of pieces in endgame mode, the search space is smaller, and you can increase the AI's search depth a little more, and the results could be even better!\n\n\u003e [!CAUTION]  \n\u003e You can also modify the pieces of the individual AI algorithms to evaluate the scores if you want, but be careful not to set the score to a limit value (like `math.inf`), which will cause the algorithm to not come up with the correct result!\n\n### Some really great features\n\nWhen you're playing chess, the terminal actually has an output! For example:\n\n\u003cfont color=\"yellow\"\u003eSCORE\u003c/font\u003e: 2  \n\u003cfont color=\"royalblue\"\u003eSTEP\u003c/font\u003e: 5  \n〇〇\u003cfont color=\"green\"\u003e象士将士象马车  \n车\u003c/font\u003e〇〇〇〇〇〇〇〇  \n〇\u003cfont color=\"green\"\u003e炮马\u003c/font\u003e〇〇〇〇\u003cfont color=\"green\"\u003e炮\u003c/font\u003e〇  \n\u003cfont color=\"green\"\u003e卒\u003c/font\u003e〇\u003cfont color=\"green\"\u003e卒\u003c/font\u003e〇\u003cfont color=\"green\"\u003e卒\u003c/font\u003e〇\u003cfont color=\"green\"\u003e卒\u003c/font\u003e〇\u003cfont color=\"green\"\u003e卒\u003c/font\u003e  \n〇〇〇〇〇〇〇〇〇  \n〇〇〇〇〇〇〇〇〇  \n\u003cfont color=\"red\"\u003e兵\u003c/font\u003e〇\u003cfont color=\"red\"\u003e兵\u003c/font\u003e〇\u003cfont color=\"red\"\u003e兵\u003c/font\u003e〇\u003cfont color=\"red\"\u003e兵\u003c/font\u003e〇\u003cfont color=\"red\"\u003e兵\u003c/font\u003e  \n〇〇\u003cfont color=\"red\"\u003e馬\u003c/font\u003e〇\u003cfont color=\"red\"\u003e砲\u003c/font\u003e〇〇\u003cfont color=\"red\"\u003e砲\u003c/font\u003e〇  \n〇〇〇〇〇〇〇〇〇  \n〇\u003cfont color=\"red\"\u003e車相仕帥仕相馬車\u003c/font\u003e  \n\nIt provides a very clear picture of the game state and the current AI score.\n\n\u003e [!WARNING]  \n\u003e Some of the pictures and other resources involved in the project come from the Internet and are not used for commercial purposes.  \n\u003e Please contact me for infringement: 2951256653@qq.com\n\n## Known Bugs\n\n- [ ] When the AI algorithm can't find anything that can get rid of the dead chess ending, it will report an error and cause the thread to crash, which in turn will cause the computer to be in a state of \"thinking\" without proceeding to the next step.\n- [ ] When starting a new game, threads from previous games will not be killed, causing the game to become unusually stuttering.\n- [ ] When connected to a local area network, when one party disconnects, the other party may crash or freeze.\n- [ ] Some of the code on statistics is broken.\n\n---\n\nIf you want to know more about this program, see: https://xiaokang2022.blog.csdn.net/article/details/128852029\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaokang2022%2Fchess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaokang2022%2Fchess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaokang2022%2Fchess/lists"}