Chess
A Chinese chess program based on tkintertools and written in CPython 3.12 and MSVC C++ 20.
Install / Use
/learn @Xiaokang2022/ChessREADME
Chess 🚀
A Chinese chess program based on tkintertools and written in Python 3.12 and C++ 20.

This program is implemented using a mix of tkinter and tkintertools modules, tkintertools is a third-party Python module that I developed on my own to beautify tkinter and provide some advanced features! 🎉
[!NOTE]
Since the original program was written by me one year ago, thetkintertoolsmodule uses the test version, and the AI of the program was added later, and the previous code quality is relatively poor, please understand. 😅
Star History
<a href="https://star-history.com/#Xiaokang2022/Chess&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Xiaokang2022/Chess&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Xiaokang2022/Chess&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Xiaokang2022/Chess&type=Date" /> </picture> </a>How to use
Before use
[!IMPORTANT]
Make sure your Python version is 3.12 or greater and C++ version is 20 or greater.
Choose the mode
run the main.py and choose a game mode you want.
I've provided 4 modes, Three of them can be selected in "新游戏",and "残局挑战" needs to be selected in the "棋局库".
One last step
have fun! 😁
Brief introduction
Base Features
- Two-player match
- Man-machine battles
- Endgame Challenge
- LAN connection
About the AI
I've provided 2 AI algorithms, one of which also provides an implementation of C++20:
- Minimum-Max search algorithm
- Python: min_max_search.py
- Alpha-beta pruning algorithm
- Python: alpha_beta_search.py
- C++ (default):
- src: ./cpp/alpha_beta_search.cpp
- dll: ./alpha_beta_search.dll
You can change them in the settings. By the way, default value of the search depth is 4.
[!TIP]
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!
[!CAUTION]
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 (likemath.inf), which will cause the algorithm to not come up with the correct result!
Some really great features
When you're playing chess, the terminal actually has an output! For example:
<font color="yellow">SCORE</font>: 2
<font color="royalblue">STEP</font>: 5
〇〇<font color="green">象士将士象马车
车</font>〇〇〇〇〇〇〇〇
〇<font color="green">炮马</font>〇〇〇〇<font color="green">炮</font>〇
<font color="green">卒</font>〇<font color="green">卒</font>〇<font color="green">卒</font>〇<font color="green">卒</font>〇<font color="green">卒</font>
〇〇〇〇〇〇〇〇〇
〇〇〇〇〇〇〇〇〇
<font color="red">兵</font>〇<font color="red">兵</font>〇<font color="red">兵</font>〇<font color="red">兵</font>〇<font color="red">兵</font>
〇〇<font color="red">馬</font>〇<font color="red">砲</font>〇〇<font color="red">砲</font>〇
〇〇〇〇〇〇〇〇〇
〇<font color="red">車相仕帥仕相馬車</font>
It provides a very clear picture of the game state and the current AI score.
[!WARNING]
Some of the pictures and other resources involved in the project come from the Internet and are not used for commercial purposes.
Please contact me for infringement: 2951256653@qq.com
Known Bugs
- [ ] 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.
- [ ] When starting a new game, threads from previous games will not be killed, causing the game to become unusually stuttering.
- [ ] When connected to a local area network, when one party disconnects, the other party may crash or freeze.
- [ ] Some of the code on statistics is broken.
If you want to know more about this program, see: https://xiaokang2022.blog.csdn.net/article/details/128852029
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
84.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
341.8kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
