Bug found in OliThink 5.1.9 => Corrected code (5.2.0) onl

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Bug found in OliThink 5.1.9 => Corrected code (5.2.0) onl

Post by OliverBr »

Hello...

While translation Olithink 5.1.9 source code into Java I found a severe bug in OliThink 5.1.9

I corrected the bug and released a new Version 5.2.0 and put it online on my homepage:

http://home.arcor.de/dreamlike/chess/index.html

Unfortunately I do not have any Windows Compiler installed. If someone here could help me out and compile OliThink for Windows32 and Windows64. Please provide an optimized and stripped Executable.
Thank You.

PS:
in search() the following line:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || TO(m) & 48) == 0) ext++; //Pawn short to promote
Was plain NONSENSE. Unfortunately C does not complain about the senseless stuff while Java does. So I found the error and the line must be:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || (TO(m) & 48) == 0)) ext++; //Pawn short to promote
User avatar
Jim Ablett
Posts: 2274
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by Jim Ablett »

Image
OliThink 5.2.0 JA by Oliver Brausch

Windows win32 & x64 Msvc p.g.o builds.

Download:
http://www.mediafire.com/?zr2ddidkzjz


Jim.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by michiguel »

OliverBr wrote:Hello...

While translation Olithink 5.1.9 source code into Java I found a severe bug in OliThink 5.1.9

I corrected the bug and released a new Version 5.2.0 and put it online on my homepage:

http://home.arcor.de/dreamlike/chess/index.html

Unfortunately I do not have any Windows Compiler installed. If someone here could help me out and compile OliThink for Windows32 and Windows64. Please provide an optimized and stripped Executable.
Thank You.

PS:
in search() the following line:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || TO(m) & 48) == 0) ext++; //Pawn short to promote
Was plain NONSENSE. Unfortunately C does not complain about the senseless stuff while Java does. So I found the error and the line must be:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || (TO(m) & 48) == 0)) ext++; //Pawn short to promote
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel
User avatar
Graham Banks
Posts: 44573
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by Graham Banks »

Hi Oliver,

I'm glad you found the bug. Hopefully OliThink won't give away a rook or queen for nothing now, as it was doing every tenth game or so.

Cheers,
Graham.
gbanksnz at gmail.com
OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr »

Graham Banks wrote:Hi Oliver,

I'm glad you found the bug. Hopefully OliThink won't give away a rook or queen for nothing now, as it was doing every tenth game or so.

Cheers,
Graham.
Hi Graham, it's actually only *a* bug, I don't except it will change this strange behaviour at your tests, but we will eventually see.

Thanks anyway.
OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr »

michiguel wrote:
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel
Neither gcc, nor Visual Studio complained about it (with warnings on, of course).
OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr »

Jim Ablett wrote:Image
OliThink 5.2.0 JA by Oliver Brausch

Windows win32 & x64 Msvc p.g.o builds.

Download:
http://www.mediafire.com/?zr2ddidkzjz


Jim.
Thanks a lot, Jim.

Executables are now ready for download:

http://home.arcor.de/dreamlike/chess/index.html
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by michiguel »

OliverBr wrote:
michiguel wrote:
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel
Neither gcc, nor Visual Studio complained about it (with warnings on, of course).
You are right

Code: Select all

#include <stdio.h>

#define PIECE(m) m
#define TO(m) m
#define PAWN 1

int main (void)
{
	int m=1;
	int ext = 0;
#if 1
	if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || TO(m) & 48) == 0) ext++;
#else
	if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || (TO(m) & 48) == 0)) ext++;
#endif
	printf ("ext=%d\n", ext);
	return 0;
}
GCC gives no warning in either case with
gcc -Wall -Wextra temp.c -o temp
:shock:

However splint detects it

First version:

Code: Select all

Splint 3.1.2 --- 07 May 2008

temp.c: (in function main)
temp.c:13:36: Right operand of || is non-boolean (int):
                 (m & 48) == 48 || m & 48
  The operand of a boolean operator is not a boolean. Use +ptrnegate to allow !
  to be used on pointers. (Use -boolops to inhibit warning)

Finished checking --- 1 code warning
Corrected version:

Code: Select all

Splint 3.1.2 --- 07 May 2008

Finished checking --- no warnings
This must be some sort of pathological case for the warning detection. As I said, if I include

if (TO(m) & 48 == 0)
ext++;

I get with gcc -Wall -Wextra temp.c -o temp

temp.c: In function ‘main’:
temp.c:17: warning: suggest parentheses around comparison in operand of &

Miguel
PS: Note to myself => I have to keep using splint!!
OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr »

Hmm, actually the line works fine. Too fine!

There is now too much extension now and thus the search depth lower.
I have to release a 5.2.1 version soon with just that line completely removed.

:(
OliverBr
Posts: 846
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr »

Update: I made now a 5.2.1 and released the source. Before I ask you for help compiling it, I will do some tests on a linux machine first.

Thank you for your support.