Search found 13 matches

by ajaxuk
Fri Jun 19, 2020 10:49 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

Great help, thank you for the tips on PeSTO, I will look more into it. It's not that I have never programmed before, just that I am not a programmer by profession and so all i have learned is from books and practice. If a professional programmer looked at my code they would cringe. My first experien...
by ajaxuk
Fri Jun 19, 2020 8:03 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

minor addition... each "bucket needs to have the low order 6 bits of the address as 000000, which makes each bucket lie on an address that starts a 64 bit block of memory that gets read in in one cache fill cycle. If it spans a 64 bit address break, it will take two cache fill cycles which is bad f...
by ajaxuk
Fri Jun 19, 2020 8:02 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

Keep checking that zobrist key anytime you change anything in that function. It's very finicky. If you found my earlier topic about hashing, look into the following: - buckets (multiple spots at the same hash index) - the amount of data that can be retrieved with one memory read (64 bytes, if I rem...
by ajaxuk
Thu Jun 18, 2020 6:07 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

The code seems fine to me. If you change the find function to just return false (which should effectively disable hashing), do you still get the wrong value? If you get the right value, then I think your hash function must be missing a parameter, for example, en passant or castling rights. The numb...
by ajaxuk
Thu Jun 18, 2020 5:59 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

The code seems fine to me. If you change the find function to just return false (which should effectively disable hashing), do you still get the wrong value? If you get the right value, then I think your hash function must be missing a parameter, for example, en passant or castling rights. The numb...
by ajaxuk
Thu Jun 18, 2020 2:07 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

I think I am comfortable with the legality of my supposedly 100% legal move generator (famous last words) I also have implemnted Zobrist hashing and a very rudimentary hash table. Alas, I cannot get the correct answer for the initial positon and depth 5 onwards while implementing a perftHash functio...
by ajaxuk
Tue Jun 16, 2020 1:53 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

I'm compiling for 64-bit, and I also set RUSTFLAGS = "-Ctarget-cpu=skylake", to use BMI2 instructions. (If you're using a C or C++ compiler, it probably has a CFLAGS or CXXLAGS environmental variable with a similar option.) If I compile as a 32-bit program, speed drops by 45-50% as you have noticed...
by ajaxuk
Sat Jun 13, 2020 6:58 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

I'm in the stages of writing a chess engine myself. I've also done some perft optimizations a month or 2 ago: http://talkchess.com/forum3/viewtopic.php?t=73577 We optimized without any 'tricks', and we don't strip out anything we actually need for playing chess. Just plain old perft, that counts do...
by ajaxuk
Sat Jun 13, 2020 6:50 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

Ok, it is getting late and it is Friday, but I have pasted this in to my code and get pretty much the same results as my original Perft routine... I am obviously doing something silly... hopefully clarity will come in the morning. Note that if you use "nodes" to calculate nodes per second, it will ...
by ajaxuk
Fri Jun 12, 2020 5:28 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Perft speed and depth questions
Replies: 43
Views: 9700

Re: Perft speed and depth questions

Bulk counting is the easiest tweak you can apply when already having a fully legal move generator. Your code would look like this: uint64 nodes = 0; uint64 Board::Perft(int depth) { MoveList moves; uint64 leaves = 0; assert(depth > 0); ++nodes; int nMoves = genMoves(moves); if (depth == 1) return n...