It's not a defeat: I'm trying to help you, not to beat youZirconiumX wrote:I admit defeat...
Lucas was right.

Moderator: Ras
It's not a defeat: I'm trying to help you, not to beat youZirconiumX wrote:I admit defeat...
Lucas was right.
??ZirconiumX wrote: Out of interest, if you declare a typedef struct as extern, which order do the keywords go in? (I think typedef extern struct is correct, but I'll ask anyway)
If you're running Linux, you can have a look at the Linux Kernel header files directly:lucasart wrote:Ah OK, I understand what you mean with typedef extern. Have a look here, it's all explained:
http://www.allegro.cc/forums/print-thread/588235
Code: Select all
lucas@megatron:~$ find /usr/src/linux-headers-3.0.0-14-generic/include/ -iname "*.h" -exec grep "extern struct" {} \;
However, your substitution code for eastOne() and westOne() is not the same as in CPW. Again, you need to take care of the wraparound. In CPW "eastOne(U64 b)" is defined as "(b & notHFile) << 1" (there is also an equivalent second way) and "westOne()" accordingly.ZirconiumX wrote:Blame the CPW for that:I don't have a nortOne or a SoutOne function, so I subsituted the actual code for it.Code: Select all
U64 kingAttacks(U64 kingSet) { U64 attacks = eastOne(kingSet) | westOne(kingSet); kingSet |= attacks; attacks |= nortOne(kingSet) | soutOne(kingSet); return attacks; }
How about C++, Lucas?lucasart wrote:Ah OK, I understand what you mean with typedef extern. Have a look here, it's all explained:
http://www.allegro.cc/forums/print-thread/588235
Code: Select all
struct A {
...
};
...
extern A my_a;
extern A * my_a_ptr;
If I Coul;d have only the good stuff in C++ without all the crap, why not. But post C++98 exceptions are everywhere in the STL and even thrown by language operators...Sven Schüle wrote:How about C++, Lucas?lucasart wrote:Ah OK, I understand what you mean with typedef extern. Have a look here, it's all explained:
http://www.allegro.cc/forums/print-thread/588235
No need for a "typedef" for structs any longer, "A" from the declaration "struct A" is already the name of the type (since "struct" is a special form of "class" where all members are public).Code: Select all
struct A { ... }; ... extern A my_a; extern A * my_a_ptr;
999:998 for C++
Sven
You can use C++ without using any single line of STL. All my chess programs were written in C++ but there was never STL in it. Actually you don't need STL for chess programming.lucasart wrote:If I Coul;d have only the good stuff in C++ without all the crap, why not. But post C++98 exceptions are everywhere in the STL and even thrown by language operators...Sven Schüle wrote:How about C++, Lucas?lucasart wrote:Ah OK, I understand what you mean with typedef extern. Have a look here, it's all explained:
http://www.allegro.cc/forums/print-thread/588235
No need for a "typedef" for structs any longer, "A" from the declaration "struct A" is already the name of the type (since "struct" is a special form of "class" where all members are public).Code: Select all
struct A { ... }; ... extern A my_a; extern A * my_a_ptr;
999:998 for C++
Sven
But if you don't use STL in your chess program, why do you use C++ anyway ? Is it just because of this syntactic sugar (classes and the like can be written in plain C very well)Sven Schüle wrote:You can use C++ without using any single line of STL. All my chess programs were written in C++ but there was never STL in it. Actually you don't need STL for chess programming.lucasart wrote:If I Coul;d have only the good stuff in C++ without all the crap, why not. But post C++98 exceptions are everywhere in the STL and even thrown by language operators...Sven Schüle wrote:How about C++, Lucas?lucasart wrote:Ah OK, I understand what you mean with typedef extern. Have a look here, it's all explained:
http://www.allegro.cc/forums/print-thread/588235
No need for a "typedef" for structs any longer, "A" from the declaration "struct A" is already the name of the type (since "struct" is a special form of "class" where all members are public).Code: Select all
struct A { ... }; ... extern A my_a; extern A * my_a_ptr;
999:998 for C++
Sven
In other areas of software development things are probably different. But I promised not to try converting you
Sven
EDIT: Sorry to Matthew for hijacking your thread, I think I'll stop now.