Patch for crafty annoyance

Discussion of chess software programming and technical issues.

Moderator: Ras

jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Patch for crafty annoyance

Post by jwes »

Sometimes crafty does not show a pv. This is usually because it finds a mate or an egtb result before it has searched enough nodes to start showing search results. There is code that is supposed to take care of this, but it was broken sometime in version 19.
The changes are all in iterate.c. The line numbers refer to version 23.2.

Add to the declarations at line 26:

Code: Select all

  int savevalue;
  PATH savepv;
  int print_ok = 0;
Change the code at line 468 from:

Code: Select all

        if (!time_abort && !abort_search && (root_print_ok ||
                correct_count >= early_exit || value > MATE - 300 ||
                tree->pv[0].pathh == 2)) {
          if (value != -(MATE - 1))
            DisplayPV(tree, 5, wtm, end_time - start_time, value,
                &tree->pv[0]);
        }
to

Code: Select all

		if (!time_abort && !abort_search) {
			if (root_print_ok) {
				if (value != -(MATE - 1))
					DisplayPV(tree, 5, wtm, end_time - start_time, value,
					&tree->pv[0]);
			}
			else if (value != -(MATE - 1))
			{
				savevalue=value;
				savepv=tree->pv[0];
				print_ok = 1;
			}
		}
Add before line 512:

Code: Select all

	  if (!root_print_ok && print_ok)
	  {
		  root_print_ok = 1;
		  DisplayPV(tree, 5, wtm, end_time - start_time, savevalue, &savepv);
	  }
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Patch for crafty annoyance

Post by Sven »

jwes wrote:Change the code at line 468 from:

Code: Select all

        if (!time_abort && !abort_search && (root_print_ok ||
                correct_count >= early_exit || value > MATE - 300 ||
                tree->pv[0].pathh == 2)) {
          if (value != -(MATE - 1))
            DisplayPV(tree, 5, wtm, end_time - start_time, value,
                &tree->pv[0]);
        }
to

Code: Select all

		if (!time_abort && !abort_search) {
			if (root_print_ok) {
				if (value != -(MATE - 1))
					DisplayPV(tree, 5, wtm, end_time - start_time, value,
					&tree->pv[0]);
			}
			else if (value != -(MATE - 1))
			{
				savevalue=value;
				savepv=tree->pv[0];
				print_ok = 1;
			}
		}

Code: Select all

		if (!time_abort && !abort_search && value != -(MATE - 1)) {
			if (root_print_ok) {
				DisplayPV(tree, 5, wtm, end_time - start_time, value, &tree->pv[0]);
			} else {
				savevalue = value;
				savepv = tree->pv[0];
				print_ok = 1;
			}
		}
would do the same.
Sven
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Patch for crafty annoyance

Post by jwes »

Bob, did you see this?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Patch for crafty annoyance

Post by bob »

jwes wrote:Bob, did you see this?
I thought this had already been fixed once?

I'll check however...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Patch for crafty annoyance

Post by bob »

bob wrote:
jwes wrote:Bob, did you see this?
I thought this had already been fixed once?

I'll check however...
it is definitely in the current version...

Just noticed the date of the post. I think I fixed it at that point...

Bob