For Miguel B: Gaviota tb_availability() sometimes incorrect

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Houdini
Posts: 1471
Joined: Tue Mar 16, 2010 12:00 am

For Miguel B: Gaviota tb_availability() sometimes incorrect

Post by Houdini »

Miguel,

I've received several reports of Houdini not finding Gaviota tablebases when not all EGTB files are present. I've traced it down to the tb_availability() function not returning the correct value.

Three simple test cases:

1) EGTB folder contains only kqkr.gtb.cp4
=> tb_availability returns 1 instead of the correct 4.

2) EGTB folder contains kqkr.gtb.cp4 and kbk.gtb.cp4
=> tb_availability returns 3 instead of the correct 5.

3) EGTB folder contains kqkr.gtb.cp4, kbk.gtb.cp4 and kqpkq.gtb.cp4
=> tb_availability returns 7 instead of the correct 21.

Can you look into this problem?

Thanks,
Robert
User avatar
Houdini
Posts: 1471
Joined: Tue Mar 16, 2010 12:00 am

Re: For Miguel B: Gaviota tb_availability() sometimes incorr

Post by Houdini »

It appears the problem is in zipinfo_init:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j++;
		if (complet[x]) z |= 1 << j++;
	}
should probably be:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j;
		j++;
		if (complet[x]) z |= 1 << j;
		j++;
	}
Robert
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: For Miguel B: Gaviota tb_availability() sometimes incorr

Post by michiguel »

Houdini wrote:It appears the problem is in zipinfo_init:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j++;
		if (complet[x]) z |= 1 << j++;
	}
should probably be:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j;
		j++;
		if (complet[x]) z |= 1 << j;
		j++;
	}
Robert
I will take a look at it tonight.

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

Re: For Miguel B: Gaviota tb_availability() sometimes incorr

Post by michiguel »

michiguel wrote:
Houdini wrote:It appears the problem is in zipinfo_init:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j++;
		if (complet[x]) z |= 1 << j++;
	}
should probably be:

Code: Select all

	for (j = 0, z = 0, x = 3; x < 8; x++) {
		if (partial[x]) z |= 1 << j;
		j++;
		if (complet[x]) z |= 1 << j;
		j++;
	}
Robert
I will take a look at it tonight.

Miguel
You are absolutely correct. Thanks!

Bug fixed and modified sources pushed to git hub.
https://github.com/michiguel/Gaviota-Tablebases

Miguel