gull chess
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
Perhaps you meant this?
#define ExtFlag(ext) (((unsigned) ext) << 16)
#define Ext(flags) ((((unsigned) flags) >> 16) & 0xF)
#define ExtFlag(ext) (((unsigned) ext) << 16)
#define Ext(flags) ((((unsigned) flags) >> 16) & 0xF)
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
You should do this:
typedef struct GProcessInfo {
volatile LONG searching;
volatile LONG flags; // for stop order & fail high signal
GMoveList MoveList[128];
} GProcessInfo;
because with intrin.h and 64 bit compile, LONG can become long long (examine the intrin.h header file and you will see routine versions with x64 name extensions that take long long).
typedef struct GProcessInfo {
volatile LONG searching;
volatile LONG flags; // for stop order & fail high signal
GMoveList MoveList[128];
} GProcessInfo;
because with intrin.h and 64 bit compile, LONG can become long long (examine the intrin.h header file and you will see routine versions with x64 name extensions that take long long).
-
- Posts: 144
- Joined: Sun Jun 13, 2010 7:32 am
- Contact:
Re: gull chess
It activates "learning" (implemented via a "permanent" hash table saved to a file).User923005 wrote:Why do you have HASH_STORE undefined by default?
"ext" is supposed to be a nonnegative integer < 8, so no need to make it unsigned.User923005 wrote:Perhaps you meant this?
Thanks!User923005 wrote:I suggest to examine this:
And the same for volatile LONG lock in GOptex class?User923005 wrote:LONG can become long long
-
- Posts: 144
- Joined: Sun Jun 13, 2010 7:32 am
- Contact:
Re: gull chess
Why use it then (instead of long)? These variables are supposed to be 32-bit integers.User923005 wrote:LONG can become long long
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
Sometimes.
Consider, for instance this bit from Winbase.h:
#if defined(_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined(_WINBASE_))
FORCEINLINE
unsigned __int64
InterlockedExchange(
__inout __drv_interlocked unsigned __int64 volatile *Target,
__in unsigned __int64 Value
)
{
return (unsigned __int64) InterlockedExchange64((volatile __int64*) Target, (__int64) Value);
}
#endif
If you define them as LONG, they will always become the right thing. If you don't you will get undefined behavior.
It's not crazy. It's Windows. Wait... it is crazy isn't it?
Consider, for instance this bit from Winbase.h:
#if defined(_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined(_WINBASE_))
FORCEINLINE
unsigned __int64
InterlockedExchange(
__inout __drv_interlocked unsigned __int64 volatile *Target,
__in unsigned __int64 Value
)
{
return (unsigned __int64) InterlockedExchange64((volatile __int64*) Target, (__int64) Value);
}
#endif
If you define them as LONG, they will always become the right thing. If you don't you will get undefined behavior.
It's not crazy. It's Windows. Wait... it is crazy isn't it?
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
Yes.ThinkingALot wrote: And the same for volatile LONG lock in GOptex class?
Make it a SCREAMING long:
Code: Select all
typedef struct GOptex {
volatile LONG lock;
HANDLE semaphore[MaxPrN]; // handles for each process
} GOptex;
It turns out that sometimes LONG will become long long.
It might seem strange, at first, but when I thought about it, it makes sense for Windows environment where long is only 4 bytes and an address is 8 bytes.
That way, a LONG can hold an address reliably, and Windows pulls that cheesy trick all the time. I don't know why they didn't just use actual addresses, but there we are.
Re: gull chess
Hello,ThinkingALot wrote:Why use it then (instead of long)? These variables are supposed to be 32-bit integers.User923005 wrote:LONG can become long long
Really appreciate your engine Gull. Its code is apparently simple, yet very strong on the ELO scale. And it's certainly not a cheap rip-off from anything else, contrary to what some trolls have said. So a great contribution to the community!
Is there any poroject to make the code portable one day ? It seems that there is a lot of Windows/MSVC dependancy in there that could very easily be avoided. To begin with, how about using only portable types, as defined in <inttypes.h> ?
"Talk is cheap. Show me the code." -- Linus Torvalds.
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
Since it is an open source project, it would be easy to fork it or to contribute to the existing project.
The oddball stuff is only needed for SMP, so a simple translation layer like so many other chess programs have for threading would do the trick.
The oddball stuff is only needed for SMP, so a simple translation layer like so many other chess programs have for threading would do the trick.
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: gull chess
Thinkingalot is a good example, as far as giving credit where credit is due. From his readme:lucasart wrote:Hello,ThinkingALot wrote:Why use it then (instead of long)? These variables are supposed to be 32-bit integers.User923005 wrote:LONG can become long long
Really appreciate your engine Gull. Its code is apparently simple, yet very strong on the ELO scale. And it's certainly not a cheap rip-off from anything else, contrary to what some trolls have said. So a great contribution to the community!
Is there any poroject to make the code portable one day ? It seems that there is a lot of Windows/MSVC dependancy in there that could very easily be avoided. To begin with, how about using only portable types, as defined in <inttypes.h> ?
"A derivative of Gull 1.2 (program structure, board representation, move generators etc.) & Ivanhoe (versions 63 & 46: evaluation).
Whether future versions will retain Ivanhoe's evaluation is still undecided."
Re: gull chess
Yes, but the entire code is riddled with unportable things, in place where it is neither necessary nor useful (__int64 to begin with). And for SMP, there is absolutely no need to write unportable code. C++11 has all one needs to write it clean, portable, safe and simple code. In the C++11 branch of Stockfish, Marco demonstrates that fact with "maestria".User923005 wrote:Since it is an open source project, it would be easy to fork it or to contribute to the existing project.
The oddball stuff is only needed for SMP, so a simple translation layer like so many other chess programs have for threading would do the trick.
"Talk is cheap. Show me the code." -- Linus Torvalds.