mvanthoor wrote: ↑Fri Mar 19, 2021 6:41 pm
"Killers, Heuristics, and Personality is version 1.0 and it will be done." Repeat 10 times. Make 2-3 video's to go along with adding QSearch, PST's, and the Killer/Heuristics, and wrap it up. Everything after this, is already Basics++ (TT, Aspriation windows, PVS), and everything after that is getting into the advanced things already.
Sounds like plan!
Only that instead of personalities I'm going to look into auto-tuned tapered evaluation! I hope that I can generate something comparable in strength to the PeSTO tables because these fix all my issues with converting won endgames it seems.
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
So you made a pledge to write a "minimal" chess engine. You have tied your hands to an artificial concept. What is minimal? Minimal is one ply + SEE. Or is minimal defined as minimal a/b. Minimal seems to be a moving target depending on what side of the bed one gets up from each morning.
Can't say I disagree with anything you said there!
My original plans where to stop at the state of the last of my videos. Fixed 4-ply depth alpha-beta search with material counting evaluation. But at that point the engine just didn't play very good chess. And my goals shifted when I joined this community and learned about engine-vs-engine ranking lists and how hard it is to find good, well maintained engines in the 1000-2000 ELO range to play against. I wondered if I couldn't just fix the most obvious blunders so that the minimal engine would still be small and simple but also play decent chess. And both version 0.2 and 0.3 are not quite there yet but they at least make good sparring partners in their respective elo range I think.
As a definition for minimal your "minimal a/b" idea isn't a bad start. '
b' would be the amount and complexity of the code and '
a' would be the strength of the engine in ELO.
If, in an attempt to be as objective as possible, I compare my engine with other C# engines through Visual Studio's "analyze code metrics" feature than I receive better scores regarding maintainability and cyclomatic complexity. They may have the stronger engine but for 50% more ELO they had to write 500% more code. Code that is also more difficult to understand.
So isn't the attempt of making an engine that plays some solid chess at ~2000 ELO (and thus can beat myself and most other human players) that is open source under a very permissive license (MIT) and implemented in a way that is relatively easy for a human mind to follow, not a worthy goal?
If anyone thinks it should be faster you can fork it and make it faster! You wouldn't even have to open source your improved version.
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
Code: Select all
static readonly int[] KING_FILE = new int[8] { -1, 0, 1, 1, 1, 0, -1, -1 };
static readonly int[] KING_RANK = new int[8] { -1, -1, -1, 0, 1, 1, 1, 0 };
Two pointers means two registers used. Why not one structure that would only use one pointer?
The code you're looking at is run only once at startup. So it's performance doesn't matter. It just generates a few kb of lookup tables so that I can look up for every piece and it's current square what other squares it can move to. That's exactly like your magnitude table only that I store the actual square indices so they don't have to be generated in a for-loop in the actual move generation code. I don't think magnitude tables and for loops that still have to add positions + directional offset at runtime would be faster but if you think so I may give it a try just to be sure.
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
The Attacks() function to me looks like it should be an initiation for a vector magnitude table.
So in summary... that's what it already is?!
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
Unmodified TSCP is already a minimal engine and everyone hates this approach that TSCP uses because even though TSCP is written in C it is dirt slow.
Well, I only hate it because it sometimes stalls in cutechess-cli when I play 1000 games and then I have to restart the test. I don't care about it's speed or implementation because I deliberately picked it because it plays at MinimalChess's current strength.
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
So, if I were you (and I'm not) I would do something minimal to optimize this like have u64 piece[wtm]. Each bit of piece[wtm] is a piece on the board.
Interesting suggestion! But how exactly would I iterate over the bits? Isn't that where you need compiler intrinsics like _BitScanForward? I guess whether it makes sense for MinimalChess depends on that detail.
But I like it because it doesn't make the board instance much fatter, wich would be bad because I have no move-undo and make new instances whenever I play a move. And it's based on a simple enough concept!
Mike Sherwin wrote: ↑Fri Mar 19, 2021 7:39 pm
If you are going to downshift and take a hard left turn and start over are you going to stay with C#? That sounds sub optimal. On the other hand if there was a compiler that compiled extended C# to native code then that would make sense for chess. That compiler is Beef.
I'm still not really sure how much slower C# would be if I took a performance-oriented approach. So I think I would start with implementing a bitboard move generator and something like perft again to figure out how much slower C# actually is compared to C/C++. At that point it would also be interesting to see how to compile that code with Beef and how fast that would be.
Just my two pence.
Thanks for taking the time and I appreciate your critical eye!