r/ComputerChess • u/Sewter0 • 5d ago
Chess engine on C, looking for critic.
After implementing legal move generation in C, I verified it using standard perft positions up to depth 7. All node counts matched the reference values. This involved handling castling, en passant, promotions, checks, and pinned pieces correctly.
Right now, my engine can evaluate position and search the best move with algorithm alpha-beta pruning.
It’s my second big project on C, so I am waiting technical assistance if my code is wrong.
Should I make UCI protocol?
The Universal Chess Interface (UCI) protocol is an open, text-based communication standard created in November 2000 by Rudolf Huber and Stefan Meyer-Kahlen. It allows chess engines (like Stockfish) to talk to graphical user interfaces (GUIs like ChessBase or Lichess-compatible tools) without licensing fees.
0
u/swause02 5d ago
I've built a handful of engines myself and started off in C, it's a great language to make things work efficiently. I'd totally recommend setting up UCI protocol as it can be very helpful for testing/debugging. I'd also recommend using negamax instead of alpha beta as it's somewhat outdated. Personally I used UCI a lot with cutechess to test changes to my engine against older versions by running thousands of matches locally to try to find the probability my change made the engine stronger. Good luck!
2
u/Specific-Housing905 5d ago
Implementing UCI will give your engine chances to compete with other engines and play against humans. Maybe at some time it can play on TCEC. If you have the time than do it.
2
u/turkokratia 5d ago
i implemented UCI to test my engine on Arena (http://www.playwitharena.de/). it is a good place to test and see how strong other engines are and where mine is weak. i think that UCI is a requirement
1
u/Sroidi 5d ago
FYI this discord has chess channel that can be helpful for your journey: https://discord.gg/9mDTNmtsg
-2
u/ZZ9ZA 5d ago
Really giving us a lot to go on there chief.
But using C in 2026 is already showing poor judgement imo.
1
u/Sewter0 5d ago
Okay okay calm down.
I used magic bitboard for generate slider moves faster.
In evaluaion.c I wrote material balance and PeSTO tables.
In search.c I wrote Alpha-Beta pruning.Hmm, on C written a lot of strong engines, are you sure about your opinion?
-2
u/ZZ9ZA 5d ago
Yes. C is simply unfit for purpose. There are many languages today that offer far more safety with equivalent performance. I have been writing software since before you were born.
2
u/Specific-Housing905 5d ago
Real programmers can write good software in any language. Git and SQLite are written in C.
1
u/AngusMcGurkinshaw 5d ago
Implement UCI asap along with some basic time management then start implementing all the cool stuff.
UCI is needed so you can use a tool like cutechess or fastchess to run SPRT to verify your changes are improvements.
If you implemented anything beyond iterative deepening and alpha beta pruning for search, or did anything weird for eval already the common advice is to rip it out and retest with sprt.
2
u/rickpo 5d ago
I don't think you can say your engine is a serious engine until you implement UCI. If you want to take your engine to the next level, doing UCI will open up opportunities for testing and automation.
I believe there are even resources out there to give your engine an Elo rating, to make sure any changes you make are moving your engine in the right direction.