attack and index

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

attack and index

Postby rajeshverma423 » 20 Jul 2012, 08:54

Code : http://www.koders.com/java/fid2A9848F82 ... SideEffect

Position : e4e5 Bc4



What will be the value used of attack : public static int calcRookControl(Position pos, int sqSrc, byte[] attack) {
return calcSlideControl(pos, sqSrc, attack, true);
}

Which is board index?
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 21 Jul 2012, 10:07

rajeshverma423 wrote:Code : http://www.koders.com/java/fid2A9848F82 ... SideEffect

Position : e4e5 Bc4



What will be the value used of attack : public static int calcRookControl(Position pos, int sqSrc, byte[] attack) {
return calcSlideControl(pos, sqSrc, attack, true);
}

Which is board index?

The routines are apparently called for each bishop and rook, so after e4e5 Bc4 with {c1,c4},{c8, f8} and {a1,h1}, {a8,h8}, that is calcSlideControl is called 8 times with the squares where the pieces actually reside on the board. The total mobility or control value is then the sum of white pieces minus sum of black pieces.

calcSlideControl somehow aggregates a kind of mobility / x-ray mobility or control measure per sliding piece. Board index of a rook or bishop is sqSrc, the weights or boni of squares are passed via attack[]. It loops over all four ray directions and all destination squares per ray to add a bonus[sqDst], starting from sqSrc + delta[dir]. It stops counting per ray after a pawn blocks the destination, but continues otherwise. Once a blocker is a piece not sharing the same move direction, weights of farther squares are divided by two (direct = false). This approach assumes pieces are mobile but pawns are not, and seems to overestimate x-ray attacks through multiple own or opponent pieces, for instance with a full back rank from the initial position, the a1 rook still indirectly controls h1!?
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: attack and index

Postby rajeshverma423 » 26 Jul 2012, 17:02

Please explain some more.
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 28 Jul 2012, 22:53

rajeshverma423 wrote:Please explain some more.

What? You need to be more concrete.

I did not inspect the code in that detail, and what conrete bonus values are passed for 64 squares via the attacks[] reference for rooks or bishops, and what scaling or unit (centipawns or millipawns or whatever) it uses, and whether the weights are pre-initialized, even a two-dimensional array of 64 weight vectors indexed by opponent king square. I would guess something like 1 centipawn or so for most squares, and more for the center and neighboring opponent king squares.
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: attack and index

Postby rajeshverma423 » 29 Jul 2012, 07:28

what about vlalpha and vlbeta?

public static int evaluate(Position pos, int vlAlpha, int vlBeta) {
// 1. Material (with Position) Value
int vl = pos.material();
if (vl + LAZY_MARGIN <= vlAlpha) {
return vl + LAZY_MARGIN;
} else if (vl - LAZY_MARGIN >= vlBeta) {
return vl - LAZY_MARGIN;
}
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 29 Jul 2012, 08:52

rajeshverma423 wrote:what about vlalpha and vlbeta?

public static int evaluate(Position pos, int vlAlpha, int vlBeta) {
// 1. Material (with Position) Value
int vl = pos.material();
if (vl + LAZY_MARGIN <= vlAlpha) {
return vl + LAZY_MARGIN;
} else if (vl - LAZY_MARGIN >= vlBeta) {
return vl - LAZY_MARGIN;
}

This is called lazy evaluation. If you are already far outside alpha (too bad) or beta (too good) with the most dominating but cheap to calculate evaluation term, the material balance, there is no need to waste cycles with expensive positional evaluation terms, which even in best or worst case can not reach the alpha-beta window.

https://chessprogramming.wikispaces.com/Lazy+Evaluation
https://chessprogramming.wikispaces.com/Alpha-Beta
https://chessprogramming.wikispaces.com/Window
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: attack and index

Postby rajeshverma423 » 29 Jul 2012, 09:21

i asked vlalpha and vlbeta values for position e4e5 Bc4.
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 29 Jul 2012, 09:34

rajeshverma423 wrote:i asked vlalpha and vlbeta values for position e4e5 Bc4.

No idea. Too lazy to inspect that code further. Likely the initial values are -oo and +oo.
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: attack and index

Postby rajeshverma423 » 29 Jul 2012, 13:57

please find that
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 29 Jul 2012, 20:10

rajeshverma423 wrote:please find that

Please find that by yourself ;-)
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: attack and index

Postby rajeshverma423 » 30 Jul 2012, 03:41

i need vlAlpha and vlBeta to track as the start of where these values come from ?
rajeshverma423
 
Posts: 6
Joined: 03 Jul 2012, 08:18

Re: attack and index

Postby Gerd Isenberg » 30 Jul 2012, 06:29

rajeshverma423 wrote:i need vlAlpha and vlBeta to track as the start of where these values come from ?

search.java public int searchQuiesc(int vlAlpha_, int vlBeta), where evaluate is called from the horizon. Alpha is initialized with checkmateValue = distance - 10000.

You need to understand Alpha-Beta algorithm a bit.
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 2 guests