My Hello World (first step) program was just talking to a chess GUI using the uci interface. It was hardcoded to move the king's pawn.
The next step would be an engine that plays legal chess. If you can generate the legal moves in a given position you can just pick one randomly.
The next step is to use a simple search algorithm like Minimax. It will require a way to compare two different positions, counting material is the simplest way to do that.
(this is how I started after watching Queen's Gambit and I even documented it in 4 Youtube videos)
Minimal Chess (simple, open source, C#) - Youtube & Github Leorik (competitive, in active development, C#) - Github & Lichess
lithander wrote: ↑Thu Feb 13, 2025 11:55 am
My Hello World (first step) program was just talking to a chess GUI using the uci interface. It was hardcoded to move the king's pawn.
The next step would be an engine that plays legal chess. If you can generate the legal moves in a given position you can just pick one randomly.
The next step is to use a simple search algorithm like Minimax. It will require a way to compare two different positions, counting material is the simplest way to do that.
(this is how I started after watching Queen's Gambit and I even documented it in 4 Youtube videos)
But this is not enough. Every single person on this forum would beat a chess engine that uses only Minimax. That's why I am interested in "minimum set" of the engine that plays somewhat decent.
Minimax is a must, Alpha Beta pruning is a must. But is a Quiescence? Or search killers/killer moves? Or Mvva? Or a Principle Variation?
you have to define "somewhat decent" then! There are a lot of simple techniques that - piled together - quickly get you to something like 2000 Elo which most casual chess players will find hard to beat.
After Minimax works you can add Iterative Deepening search with Alpha-Beta pruning that collects just the Principal Variation and when available plays PV moves first. Even when you still evaluate by counting material this should get you close to 1000 Elo, already. Adding Q-Search would push you beyond and make the engine look much less stupid. The simple MVV-LVA move ordering will give another big boost. At some point you should add Piece-Square-Tables instead of assuming a piece has a fixed material value... adding Transposition Tables are also a huge win at this point.
...the sequence in which you add features is not super critical and you can just stop when you feel your engine has reached that MVP stage. Quiescence, MVV-LVA and Principle Variation are quite important. Killers not so much. I'd rather go for the TT at that point. And a better eval.
Minimal Chess (simple, open source, C#) - Youtube & Github Leorik (competitive, in active development, C#) - Github & Lichess
lithander wrote: ↑Thu Feb 13, 2025 1:06 pm
you have to define "somewhat decent" then! There are a lot of simple techniques that - piled together - quickly get you to something like 2000 Elo which most casual chess players will find hard to beat.
After Minimax works you can add Iterative Deepening search with Alpha-Beta pruning that collects just the Principal Variation and when available plays PV moves first. Even when you still evaluate by counting material this should get you close to 1000 Elo, already. Adding Q-Search would push you beyond and make the engine look much less stupid. The simple MVV-LVA move ordering will give another big boost. At some point you should add Piece-Square-Tables instead of assuming a piece has a fixed material value... adding Transposition Tables are also a huge win at this point.
...the sequence in which you add features is not super critical and you can just stop when you feel your engine has reached that MVP stage. Quiescence, MVV-LVA and Principle Variation are quite important. Killers not so much. I'd rather go for the TT at that point. And a better eval.
lithander, thank you very much for this summarizing!
This is an interesting topic. For many years and probably still, TSCP is a good if not best starting point. But it also has problems. The coding style can be confusing especially how it uses structures. And the constant translating between a board8x8[64] and a board12x10[120] is very annoying. And it is too slow.
In my opinion what is needed is a modern engine with just the very basic TSCP like search and evaluation features but also runs a bit faster. And it should be written in two languages, QB64 BASIC and C++. BASIC for those that do not know C++ and C++ because it is most popular. Then we need to put the two versions on a web site where they can be downloaded from. The C++ version will run in a class so that a multi-threaded version can follow. And authors can add features and upload those feature added versions.
I would do it but I'm too old.
Still it would be nice if something like that existed!
jaroslav.tavgen wrote: ↑Thu Feb 13, 2025 10:53 am
Oh, it was a joke! Micro-Max is the standard for undeadability.
Micro-Max was written as an experiment for how small a source code could be, and not to be an educational example. As a result it uses mostly meaningless one-character variable names.
But there does exist a version that uses meaningful variable names: https://home.hccnet.nl/h.g.muller/maximax.txt . This should not be very difficult to understand, because it is still very small, if not in number of characters then in number of statements. And in addition it is heavily commented, and there are some 20 pages of a tutorial description on what exactly the code is designed to do.