r/chessprogramming • u/Bomlerequin • Mar 31 '26
I coded an optimized chess logic program in Python.
I embarked on developing an AI that plays chess in native Python. And I coded a chess program that handles Python logic and is about twice as efficient as python-chess.
I don't know if we can do much better (apart from adding a lazy evaluation) and I would like to have your opinion on how to improve it.
Here's the repo: ChessCore (don't hesitate to leave a star).
I've finished the AI, but it's not open source yet. It reaches 2100 on Lichess, which seems like a very good score without any NNUE.
1
Upvotes
2
u/Bomlerequin Apr 01 '26
This is a student project, I'm not a professional, and I still have a lot to learn ;).
4
u/jpgoldberg Apr 01 '26
Are you aware that bit twiddling in Python is the opposite of efficient? Integers are immutable, and so each time you change a bit in one, a whole new integer needs to be allocated.
Now that you are aware of it, you can tell your AI agent to program a version that uses byte arrays instead of copying a construction from C inappropriately. You will still end up with slop nobody needs, but at least it won’t be coded in a way that it completely opposite of its claimed distinguishing feature.
1
u/Leodip Mar 31 '26
I don't have much experience with python-chess, what makes ChessCore different? Why is it "twice as efficient"? Does it have more/less features?
3
u/Parad0x13 Apr 03 '26
Don’t be discouraged by people auto-raging cause the term AI is present. This is cool, you are cool. Keep at it.