Search found 19601 matches

by hgm
Thu Apr 22, 2021 8:50 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: I did some magic bitboard "science" and mostly learned not to worry about it
Replies: 13
Views: 545

Re: I did some magic bitboard "science" and mostly learned not to worry about it

Indeed, the usual approach is to write the moves in a moveList array, assigning a sort key to them. And then later extract the moves with the highest remaining sort key when you want to search another move. And indeed, for generating only captures (as you would do in Quiescence Search), one first ca...
by hgm
Thu Apr 22, 2021 8:30 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: I did some magic bitboard "science" and mostly learned not to worry about it
Replies: 13
Views: 545

Re: I did some magic bitboard "science" and mostly learned not to worry about it

Exactly. This is why mailbox is faster than bitboard. What also appears to slow things down is that pieces don't have the same number of moves everywhere. E.g. if you do Knight moves from a lookup table uint64_t knightMoves[64], a Knight on a1 would have only 2 moves, and a Knight on e4 would have 8...
by hgm
Thu Apr 22, 2021 7:24 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: The mailbox trials
Replies: 133
Views: 15012

Re: The mailbox trials

Capture Set or Capture list? In the code shown above I again forgot to push the victim offset with the capture sets that make it to the capture stack. It is actually an inconvenience that this has to be done. It can be avoided by storing the capture sets in fixed locations, (so that the location im...
by hgm
Thu Apr 22, 2021 6:29 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Thread overhead in C++
Replies: 6
Views: 224

Re: Thread overhead in C++

This seems pretty much a wild goose chase. You will always have to use an ample safety margin, because no matter how often and how accurately you read the clock, there will be unknown and unpredicable communication delays with the GUI. And, like I pointed out, polling the clock is not necessary anyw...
by hgm
Wed Apr 21, 2021 9:19 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Thread overhead in C++
Replies: 6
Views: 224

Re: Thread overhead in C++

Why would you need a mutex for checking time? Or even, why have an extra thread for his? I can see why it solves some problems when you have one for reading input. But reading the clock is not something that can block you. If you don't want to poll you could set an alarm signal at the time you want ...
by hgm
Wed Apr 21, 2021 8:53 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: The mailbox trials
Replies: 133
Views: 15012

Re: The mailbox trials

Redesign As I was away from home a few days without an opporunity to program, I had a good opportunity to rethink everything. Which is good, because in any case I will have to rewrite a lot of what I have so far, in a way that cannot be done with incremental changes of exising code. I came to the f...
by hgm
Tue Apr 20, 2021 6:52 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: I did some magic bitboard "science" and mostly learned not to worry about it
Replies: 13
Views: 545

Re: I did some magic bitboard "science" and mostly learned not to worry about it

It would be interesting if these efforts could be somehow combined, by incorporating the various bitboard generation methods into the 'toy search' on the KiwiPete position that I use to gauge the speed of the various mailbox methods. This would only require replacement of the MoveGen() and MakeMove(...
by hgm
Mon Apr 19, 2021 9:36 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: The mailbox trials
Replies: 133
Views: 15012

Re: The mailbox trials

The code I presented earlier for detecting the MVV was close to optimal for a test on a per-move basis. But could it still be impoved by sharing work between the moves from the same node? The problem is that the exact test that is needed is dependent on the move we want to play. This is already acco...
by hgm
Mon Apr 19, 2021 11:28 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: The mailbox trials
Replies: 133
Views: 15012

Re: The mailbox trials

This concern about in-check nodes is sparked by he wish to improve the speed of SearchCaptures() by eliminating branches. We can classify branches into 3 groups: 'big decisions', which prune entire search trees. No way to avoid taking these. Then there are trivial things that sometimes must be skipp...
by hgm
Sun Apr 18, 2021 9:10 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: The mailbox trials
Replies: 133
Views: 15012

Re: The mailbox trials

Something even better: the normal (not-in-check) way of building the capture stack is a very inefficient way to just get the captures by a King. We go through the whole rigmarole of sorting the captures on the larger value groups in LVA order, while the only attacker under consideration is a King. S...