see

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

petero2
Posts: 558
Joined: Mon Apr 19, 2010 5:07 pm
Location: Sweden
Contact:

Re: see

Post by petero2 » Tue Nov 28, 2017 8:11 pm

flok wrote:(more testcases welcome but don't feel obliged :-)
I have some test cases I used when implementing SEE in cuckoochess:

https://github.com/peterosterlund2/droi ... .java#L276

In complicated cases the SEE value may depend on your implementation though. This can happen when there are multiple X-ray threats to the target square.

User avatar
Steve Maughan
Posts: 1024
Joined: Wed Mar 08, 2006 7:28 pm
Location: Florida, USA
Contact:

Re: see

Post by Steve Maughan » Tue Nov 28, 2017 9:36 pm

You may find this blog post helpful:

https://www.chessprogramming.net/static ... -in-chess/

Steve
http://www.chessprogramming.net - Maverick Chess Engine

Maarten Claessens
Posts: 98
Joined: Mon May 12, 2014 8:08 am
Location: Near Nijmegen

Re: see

Post by Maarten Claessens » Wed Nov 29, 2017 9:11 am

What about the see-value of fxe5 in this position:
[d]8/2q2k2/4rb2/4pR2/5P2/3N4/Q7/4K3 w - - 0 1
Nothing is unstable (Lawrence Krauss)

User avatar
flok
Posts: 895
Joined: Fri Mar 14, 2008 1:33 pm
Location: Gouda, the Netherlands
Contact:

Re: see

Post by flok » Wed Nov 29, 2017 9:20 am

I would say +975.

(for pawn 100, knight 325, bishop 325, rook 500, queen 975, king 10000)

elcabesa
Posts: 638
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: see

Post by elcabesa » Wed Nov 29, 2017 9:50 am

Why?
My see doesn't take in account checks and maybe pinned pieces.(I have to check the source).
I think the result depend on how you calculate it.

Maarten Claessens
Posts: 98
Joined: Mon May 12, 2014 8:08 am
Location: Near Nijmegen

Re: see

Post by Maarten Claessens » Wed Nov 29, 2017 10:34 am

WaDuuttie calculates +100 (with pin detection: PxP, not followed by QxP because of NxQ) or 0 (without pin detection: PxP BxP NxB RxN RxR QxR).
Nothing is unstable (Lawrence Krauss)

AlvaroBegue
Posts: 875
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York

Re: see

Post by AlvaroBegue » Wed Nov 29, 2017 11:33 am

flok wrote:I would say +975.

(for pawn 100, knight 325, bishop 325, rook 500, queen 975, king 10000)
That makes no sense. A [non-promoting] capture can't have an SEE value higher than the value of the captured piece, because the opponent could just stand pat after it.

User avatar
flok
Posts: 895
Joined: Fri Mar 14, 2008 1:33 pm
Location: Gouda, the Netherlands
Contact:

Re: see

Post by flok » Wed Nov 29, 2017 2:00 pm

(I'll respond later to this; no access to my development machine (my laptop at home) right now)

User avatar
flok
Posts: 895
Joined: Fri Mar 14, 2008 1:33 pm
Location: Gouda, the Netherlands
Contact:

Re: see

Post by flok » Wed Nov 29, 2017 5:03 pm

Hi Steve,

I followed your post -leaving out the early bailouts for now.
That works in some cases but not all. E.g. [d]8/2q2k2/4rb2/4pR2/5P2/3N4/Q7/4K3 w - - 0 1[/d] gives 1200.
It's probably due to that threshold. My question now is: what is the value of the threshold compared to the piece values?

Code: Select all

// xy are of the victim
int Scene::getSEE(const int x, const int y, const ChessPiece *const attacker) const
{
	const ChessPiece *const victim = b.getAt(x, y);

	const PlayerColor c = attacker -> getColor();

	// bit 0...15: if set, then a white piece can walk over and/or attack this field, 16...31 black
	const uint32_t bits = ss.back().tcs.cells[y][x];

	int see_val = victim -> getEvalVal();
	int trophy_val = attacker -> getEvalVal();

	PlayerColor sc = opponentColor(c);
	int so[] = { 0, 16 }; // where to start to search in the bit pattern. so[0] is for white
	constexpr int soe[] = { 16, 32 }; // where to stop searching. soe[0] is for white

	for&#40;; so&#91;sc&#93; < soe&#91;sc&#93;;) &#123;
		// find a 1 bit
		while&#40;&#40;bits & &#40;1 << so&#91;sc&#93;)) == 0&#41; &#123;
			// if end of pattern, stop searching
			if (++so&#91;sc&#93; == soe&#91;sc&#93;)
				break;
		&#125;

		if &#40;so&#91;sc&#93; >= soe&#91;sc&#93;)
			break;

		if &#40;sc == c&#41;
			see_val += trophy_val;
		else
			see_val -= trophy_val;

		// get eval val. bit number is an index in pieces&#91;color&#93;&#91;index&#93; pointing to the
		// piece.
		trophy_val = sc == WHITE ? pieces&#91;sc&#93;&#91;so&#91;sc&#93;&#93; -> getEvalVal&#40;) &#58; pieces&#91;sc&#93;&#91;so&#91;sc&#93; - 16&#93; -> getEvalVal&#40;);

		// on to the next bit!
		so&#91;sc&#93;++;

		sc = opponentColor&#40;sc&#41;;
	&#125;

	return see_val;
&#125;

User avatar
Steve Maughan
Posts: 1024
Joined: Wed Mar 08, 2006 7:28 pm
Location: Florida, USA
Contact:

Re: see

Post by Steve Maughan » Wed Nov 29, 2017 5:16 pm

Folkert,

The threshold is normally zero i.e. You only want winning SEE captures. But it may be higher of you're entering qsearch and you're 400 centi pawns down. In this case you could set the threshold to 400 and only find SEE moves that are better than 400 centi pawns.

Note, SEE usually doesn't take into account pinned pieces.

Steve
http://www.chessprogramming.net - Maverick Chess Engine

Post Reply