Testing attack tables

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Testing attack tables

Post by Luis Babboni »

Hello,

did my first test with a part of my pretended future chess engine.

I made a routine that do what I understand are attack tables.
Thinking I could made a missunderstanding, I explain a little more what its do:

Having an (8,8) array with the positions of all the 32 pieces (or evently less), the routine makes two new (8,8) arrays.
One with the number of white pieces attack each square and the other with the number of black pieces attack each square.

My queston is, exists an idea about wich speed for do it is good; poor or too poor?

I tested doing it 10,000 times (without changing the original (8,8) array for pieces (with 32 in it) and last 0.5 secs, that means around 5 x 1/100,000 secs for each pair of white attacked and black attaked arrays.

Note: I have a Phenom 955

Thanks.
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Testing attack tables

Post by cdani »

Hi.
It depends on to which engines are you comparing. If you compare to most modern strong engines, I think most of them does not have such type of attack tables. They are nice for solving some evaluation problems, but they are very slow.

But this is not a problem if you just are learning or trying different things. This can be seen only as a positive. And also may be you will find some interesting applications for them than nobody has thought about.
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Testing attack tables

Post by hgm »

Sounds pretty slow to me. qperft does need ~ 1sec for perft(6) on my 2.4GHz i3, which is about 5 million move generations. I don't understand why this task should take much longer than a full move generation. But instead of 5M/sec you are doing only 20k/sec. That is 250 times slower.

Another example is my Chu-Shogi engine HaChu. It starts every node with making a complex attack map for a board of 144 squares with 2x46 pieces on it. For each occupied square it keeps a 3-bit count for the number of attacks from each of the 8 directions. (Some pieces can jump over others, in Chu Shogi.) This sounds pretty comparable to what you are doing. But HaChu does about 200knps, and that is not just for making the attack maps, but also generating captures from it, and evaluating positions. And it is still 10 times faster than what you report here.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Testing attack tables

Post by Luis Babboni »

Thanks guys!

As Daniel said, it seems I could see it as learning step.... no more :lol:

In fact I decided to start learning C++ 8-)

Thats attack tables was made not just far from optimized (this question was made trying to know how much optimization I need) but in QB64 that seems to not be exactly the faster language for this kind of stuff :roll:
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Testing attack tables

Post by Daniel Anulliero »

Luis Babboni wrote:Thanks guys!

As Daniel said, it seems I could see it as learning step.... no more :lol:

In fact I decided to start learning C++ 8-)

Thats attack tables was made not just far from optimized (this question was made trying to know how much optimization I need) but in QB64 that seems to not be exactly the faster language for this kind of stuff :roll:
Qb64 , you mean quick basic ? I wrote my first engine with qb45 :wink:
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Testing attack tables

Post by Luis Babboni »

Daniel Anulliero wrote:
Luis Babboni wrote:Thanks guys!

As Daniel said, it seems I could see it as learning step.... no more :lol:

In fact I decided to start learning C++ 8-)

Thats attack tables was made not just far from optimized (this question was made trying to know how much optimization I need) but in QB64 that seems to not be exactly the faster language for this kind of stuff :roll:
Qb64 , you mean quick basic ? I wrote my first engine with qb45 :wink:
Yes, Quickbasic. QB64: http://www.qb64.net/ is a kind of language wrote in C++ and that, as far as I understood, translate the Quickbasic language to C++ before compile it. There, in this translation plus the higher level of QB compared with C++ is where the speed is lost.... of course nevertheless that, is far faster than QB4.5 that, as I understood, was interpreted , Im right?

I started with Sinclair Spectrum Basic, continue with QBasic, later QB4.5, later QB 7.1 and since I had a 64 bits system with QB64 cause QB7.1 no not works anymore without an emulator of XP 32 bits.

What annoying me more from QB64 for this long kind of programms is the not easy way to work with subroutines. In QBs was easier it seems.

But wait, I do not trying to make the great and nice QB64 as the guilty of my lack of skills to do an engine.... but, at least since yesterday.... I decided to learn C++...... I do not know yet how this attempt will finish :P

BTW, have you your engine in QB4.5?
I found other that was wrote in QB45 but to be capable to use UCI o winboard was necesary to be adapted to PowerBasic first:
http://home.pacific.net.au/~tommyinoz/db.html
http://home.pacific.net.au/~tommyinoz/minimax.html
http://home.pacific.net.au/~tommyinoz/kanguruh.html
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Testing attack tables

Post by Daniel Anulliero »

Luis Babboni wrote:
Daniel Anulliero wrote:
Luis Babboni wrote:Thanks guys!

As Daniel said, it seems I could see it as learning step.... no more :lol:

In fact I decided to start learning C++ 8-)

Thats attack tables was made not just far from optimized (this question was made trying to know how much optimization I need) but in QB64 that seems to not be exactly the faster language for this kind of stuff :roll:
Qb64 , you mean quick basic ? I wrote my first engine with qb45 :wink:
Yes, Quickbasic. QB64: http://www.qb64.net/ is a kind of language wrote in C++ and that, as far as I understood, translate the Quickbasic language to C++ before compile it. There, in this translation plus the higher level of QB compared with C++ is where the speed is lost.... of course nevertheless that, is far faster than QB4.5 that, as I understood, was interpreted , Im right?

I started with Sinclair Spectrum Basic, continue with QBasic, later QB4.5, later QB 7.1 and since I had a 64 bits system with QB64 cause QB7.1 no not works anymore without an emulator of XP 32 bits.

What annoying me more from QB64 for this long kind of programms is the not easy way to work with subroutines. In QBs was easier it seems.

But wait, I do not trying to make the great and nice QB64 as the guilty of my lack of skills to do an engine.... but, at least since yesterday.... I decided to learn C++...... I do not know yet how this attempt will finish :P

BTW, have you your engine in QB4.5?
I found other that was wrote in QB45 but to be capable to use UCI o winboard was necesary to be adapted to PowerBasic first:
http://home.pacific.net.au/~tommyinoz/db.html
http://home.pacific.net.au/~tommyinoz/minimax.html
http://home.pacific.net.au/~tommyinoz/kanguruh.html
Yes I have the source :-)
And I know the three basic programs
I can send you my source if you want but it is so weak irc
Why don't you learn C instead of C++ ? I think it's better and more "simple" to begin
Bests
Dany
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Testing attack tables

Post by Luis Babboni »

Daniel Anulliero wrote: ...
Yes I have the source :-)
And I know the three basic programs
I can send you my source if you want but it is so weak irc
...
Please!
:D
Daniel Anulliero wrote: Why don't you learn C instead of C++ ? I think it's better and more "simple" to begin
Bests
Dany
I have no idea, I thought C were just an old version of C++ :oops:
Why is better?
How simplier?

Thanks Daniel for your time!
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Testing attack tables

Post by Daniel Anulliero »

Luis Babboni wrote:
Daniel Anulliero wrote: ...
Yes I have the source :-)
And I know the three basic programs
I can send you my source if you want but it is so weak irc
...
Please!
:D
Daniel Anulliero wrote: Why don't you learn C instead of C++ ? I think it's better and more "simple" to begin
Bests
Dany
I have no idea, I thought C were just an old version of C++ :oops:
Why is better?
How simplier?

Thanks Daniel for your time!
Ok send me your email (via pm) and I'll send my old source
(it is so weak , no UCI and It's name is "bishop" ) :wink:

Well about C or C++ mm ... Personnaly I learned C just after the basic and I don't know C++ langage .
I think it is better to learn C before , seems more "simple" for me .
May be some programmers more talented than me can give some advices for you !
bests
dany
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Testing attack tables

Post by Daniel Anulliero »

---> pm :wink: