Sungorus 1.4

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

Moderators: hgm, Rebel, chrisw

swami
Posts: 6640
Joined: Thu Mar 09, 2006 4:21 am

Re: Sungorus 1.4

Post by swami »

Dann Corbit wrote:
swami wrote:
Dann Corbit wrote:
Dann Corbit wrote:
Pablo Vazquez wrote:Thanks Jorge :), but I don't know if there will be much of an elo increase, because I couldn't find the time to work on the evaluation and only made some search tweaks. Dann's test with the pvs version was very positive, though.
Just for fun, I am adding piece square tables
Here is a sungorus with pst:
http://cap.connx.com/chess-engines/new- ... -1.4pst.7z

It beat the other in a short contest, but I do not know if it is better or even if my implementation is correct.
When I load the exe in Arena 2.01, I get "Error: Create process"
It's a 64 bit binary. Do you have a 64 bit operating system?
Oh I see. I do only have a 32bit though.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Sungorus 1.4

Post by Dann Corbit »

swami wrote:
Dann Corbit wrote:
swami wrote:
Dann Corbit wrote:
Dann Corbit wrote:
Pablo Vazquez wrote:Thanks Jorge :), but I don't know if there will be much of an elo increase, because I couldn't find the time to work on the evaluation and only made some search tweaks. Dann's test with the pvs version was very positive, though.
Just for fun, I am adding piece square tables
Here is a sungorus with pst:
http://cap.connx.com/chess-engines/new- ... -1.4pst.7z

It beat the other in a short contest, but I do not know if it is better or even if my implementation is correct.
When I load the exe in Arena 2.01, I get "Error: Create process"
It's a 64 bit binary. Do you have a 64 bit operating system?
Oh I see. I do only have a 32bit though.
Here is a 32 bit version:
http://cap.connx.com/chess-engines/new- ... us.exe.bz2
swami
Posts: 6640
Joined: Thu Mar 09, 2006 4:21 am

Re: Sungorus 1.4

Post by swami »

Dann Corbit wrote:Here is a 32 bit version:
http://cap.connx.com/chess-engines/new- ... us.exe.bz2
Thanks for making a compile, Dann. Will test it soon.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Sungorus 1.4

Post by PK »

IIRC, this slight modification of eval() brought an Elo increase in a short test. I also have a bit of king safety code, but I have yet to come up with the right numbers to fill the relevant table.

Code: Select all

int sungorus::Evaluate(POS *p, int alpha, int beta)
{
    int score;

    score =  p->mat[WC] - p->mat[BC];                     // material
    score += p->pst[WC] - p->pst[BC];                     // pcsq
    score += EvaluatePawns(p, WC) - EvaluatePawns(p, BC); // pawns
    score += EvaluateKing(p, WC) - EvaluateKing(p, BC);   // endgame king pcsq

	if &#40;score > alpha - 200 && score < beta + 200&#41;        // lazy eval
        score += Mobility&#40;p, WC&#41; - Mobility&#40;p, BC&#41;;       // mobility

    if &#40;score < -MAX_EVAL&#41;                                // normalize score
        score = -MAX_EVAL;
    else if &#40;score > MAX_EVAL&#41;
        score = MAX_EVAL;

    return p->side == WC ? score &#58; -score;                // return
&#125;
swami
Posts: 6640
Joined: Thu Mar 09, 2006 4:21 am

Re: Sungorus 1.4

Post by swami »

With PST:

Code: Select all

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
	|  STS1	|  STS2	|  STS3	|  STS4	|  STS5	|  STS6	|  STS7	|  STS8	|  STS9	|  STS10	|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sungorus 1.4 PST	|    47	|    39	|    53	|    53	|    60	|    58	|    49	|    41	|    43	|    58	|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Grade	|    D	|    ?	|    C	|    C	|    B	|    C+	|    D	|    E	|    E	|    C+	|
Score / 1000	|    601	|    539	|    692	|    633	|    657	|    787	|    603	|    527	|    559	|    707	|
Grade	|    B	|    C	|    B+	|    B	|    B+	|    A	|    B	|    C	|    C+	|    A-	|
Best Move &#58;  501 / 1000  50.1 %  Grade &#58; C
Total &#58;           6305 / 10000  63.05 %  Grade &#58; B
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Sungorus 1.4

Post by Pablo Vazquez »

Dann Corbit wrote:
Dann Corbit wrote:
Pablo Vazquez wrote:Thanks Jorge :), but I don't know if there will be much of an elo increase, because I couldn't find the time to work on the evaluation and only made some search tweaks. Dann's test with the pvs version was very positive, though.
Just for fun, I am adding piece square tables
Here is a sungorus with pst:
http://cap.connx.com/chess-engines/new- ... -1.4pst.7z

It beat the other in a short contest, but I do not know if it is better or even if my implementation is correct.
Thanks Dann, I will look at it.
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Sungorus 1.4

Post by Pablo Vazquez »

PK wrote:IIRC, this slight modification of eval() brought an Elo increase in a short test. I also have a bit of king safety code, but I have yet to come up with the right numbers to fill the relevant table.

Code: Select all

int sungorus&#58;&#58;Evaluate&#40;POS *p, int alpha, int beta&#41;
&#123;
    int score;

    score =  p->mat&#91;WC&#93; - p->mat&#91;BC&#93;;                     // material
    score += p->pst&#91;WC&#93; - p->pst&#91;BC&#93;;                     // pcsq
    score += EvaluatePawns&#40;p, WC&#41; - EvaluatePawns&#40;p, BC&#41;; // pawns
    score += EvaluateKing&#40;p, WC&#41; - EvaluateKing&#40;p, BC&#41;;   // endgame king pcsq

	if &#40;score > alpha - 200 && score < beta + 200&#41;        // lazy eval
        score += Mobility&#40;p, WC&#41; - Mobility&#40;p, BC&#41;;       // mobility

    if &#40;score < -MAX_EVAL&#41;                                // normalize score
        score = -MAX_EVAL;
    else if &#40;score > MAX_EVAL&#41;
        score = MAX_EVAL;

    return p->side == WC ? score &#58; -score;                // return
&#125;
Hi Pawel,

I will also try that. Including pst, pawn structure and king centralization in the lazy eval makes sense, since they are going to be computed anyway and it will be more accurate.

IIRC from my tests, using alpha and beta to check for cutoff was as good as just using material, but I will test again.

Regards
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Sungorus 1.4

Post by PK »

I gave king safety one more try, this time with some funny formulas and not tables. Preliminary test shows that it just might be of some help, but please consider it a sketch rather than the real thing. Please nopte that it didn't work without those funny major_wood / minor_wood formulae, and that they are untuned. Fromwatching games I see that pawn shield code would be extremely helpful, too.

Possible improvements:

- king zone extending one layer forwards towards the enemy position, so that for Kg1 we consider squares f3-g3-h3 important (simplified idea from Rebel)

- sliders attacking through another sliders (i.e. RR on the same file) - Glass regenerates attack bb (not mobility bb) whenever a piece attacks a piece moving along the same ray

- major/minor formulae might be far more precise, even to the point of using two 2-dimensional tables of multipliers and dividers for each configuration of attackers

Code: Select all

int sungorus&#58;&#58;Mobility&#40;POS *p, int side&#41;
&#123;
    U64 pieces;
	U64 control;
	U64 king_zone;
	U64 att_zone;
    int from, mob, att, wood_minors, wood_majors;

    mob  = 0;
	att  = 0;
	wood_minors = 0;
	wood_majors = 0;

	king_zone = k_attacks&#91;KingSq&#40;p, side ^ 1&#41; &#93;;

    pieces = PcBb&#40;p, side, N&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = n_attacks&#91;from&#93; & ~OccBb&#40;p&#41;;
		att_zone = control & king_zone;
		// mob  += PopCnt&#40;control&#41; * 4;
		att  += PopCnt&#40;att_zone&#41;;
		wood_minors += 1;
        pieces &= pieces - 1;
    &#125;

    pieces = PcBb&#40;p, side, B&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = BAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
		mob  += PopCnt&#40;control&#41; * 4;
        att  += PopCnt&#40;att_zone&#41;;
		wood_minors += 1;
		pieces &= pieces - 1;
    &#125;

	pieces = PcBb&#40;p, side, R&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
		control = RAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
        mob  += PopCnt&#40;control&#41; * 2;
		att  += PopCnt&#40;att_zone&#41; * 3;
		wood_majors += 1;
        pieces &= pieces - 1;
    &#125;

	pieces = PcBb&#40;p, side, Q&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = QAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
		mob  += PopCnt&#40;control&#41;;
		att  += PopCnt&#40;att_zone&#41; * 4;
		wood_majors += 3;
        pieces &= pieces - 1;
    &#125;

	// normalize for table size
    if ( wood_minors > 4 ) wood_minors = 4;
	if ( wood_majors > 5 ) wood_majors = 5;

	if ( att  > 23 ) att  = 23;
	if ( wood_majors == 0 && wood_minors < 3 ) att = 0;
	if ( wood_majors > 2 ) att = ( &#40;att * 3 ) / 2 );
	if ( wood_minors > 2 || wood_majors > 3 ) att = ( &#40;att * 5 ) / 4 );

    return mob + att;
&#125;
bhlangonijr
Posts: 482
Joined: Thu Oct 16, 2008 4:23 am
Location: Milky Way

Re: Sungorus 1.4

Post by bhlangonijr »

Pablo Vazquez wrote:
PK wrote:IIRC, this slight modification of eval() brought an Elo increase in a short test. I also have a bit of king safety code, but I have yet to come up with the right numbers to fill the relevant table.

Code: Select all

int sungorus&#58;&#58;Evaluate&#40;POS *p, int alpha, int beta&#41;
&#123;
    int score;

    score =  p->mat&#91;WC&#93; - p->mat&#91;BC&#93;;                     // material
    score += p->pst&#91;WC&#93; - p->pst&#91;BC&#93;;                     // pcsq
    score += EvaluatePawns&#40;p, WC&#41; - EvaluatePawns&#40;p, BC&#41;; // pawns
    score += EvaluateKing&#40;p, WC&#41; - EvaluateKing&#40;p, BC&#41;;   // endgame king pcsq

	if &#40;score > alpha - 200 && score < beta + 200&#41;        // lazy eval
        score += Mobility&#40;p, WC&#41; - Mobility&#40;p, BC&#41;;       // mobility

    if &#40;score < -MAX_EVAL&#41;                                // normalize score
        score = -MAX_EVAL;
    else if &#40;score > MAX_EVAL&#41;
        score = MAX_EVAL;

    return p->side == WC ? score &#58; -score;                // return
&#125;
Hi Pawel,

I will also try that. Including pst, pawn structure and king centralization in the lazy eval makes sense, since they are going to be computed anyway and it will be more accurate.

IIRC from my tests, using alpha and beta to check for cutoff was as good as just using material, but I will test again.

Regards
Hi Pablo,

Have you tried using LMR in the newer version?
I think it is worth trying as it won't demand much of your time and it might give Sungorus some speed up.

Always looking forward to new releases of your very nice engine.

Regards,
bhlangonijr
Posts: 482
Joined: Thu Oct 16, 2008 4:23 am
Location: Milky Way

Re: Sungorus 1.4

Post by bhlangonijr »

PK wrote:I gave king safety one more try, this time with some funny formulas and not tables. Preliminary test shows that it just might be of some help, but please consider it a sketch rather than the real thing. Please nopte that it didn't work without those funny major_wood / minor_wood formulae, and that they are untuned. Fromwatching games I see that pawn shield code would be extremely helpful, too.

Possible improvements:

- king zone extending one layer forwards towards the enemy position, so that for Kg1 we consider squares f3-g3-h3 important (simplified idea from Rebel)

- sliders attacking through another sliders (i.e. RR on the same file) - Glass regenerates attack bb (not mobility bb) whenever a piece attacks a piece moving along the same ray

- major/minor formulae might be far more precise, even to the point of using two 2-dimensional tables of multipliers and dividers for each configuration of attackers

Code: Select all

int sungorus&#58;&#58;Mobility&#40;POS *p, int side&#41;
&#123;
    U64 pieces;
	U64 control;
	U64 king_zone;
	U64 att_zone;
    int from, mob, att, wood_minors, wood_majors;

    mob  = 0;
	att  = 0;
	wood_minors = 0;
	wood_majors = 0;

	king_zone = k_attacks&#91;KingSq&#40;p, side ^ 1&#41; &#93;;

    pieces = PcBb&#40;p, side, N&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = n_attacks&#91;from&#93; & ~OccBb&#40;p&#41;;
		att_zone = control & king_zone;
		// mob  += PopCnt&#40;control&#41; * 4;
		att  += PopCnt&#40;att_zone&#41;;
		wood_minors += 1;
        pieces &= pieces - 1;
    &#125;

    pieces = PcBb&#40;p, side, B&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = BAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
		mob  += PopCnt&#40;control&#41; * 4;
        att  += PopCnt&#40;att_zone&#41;;
		wood_minors += 1;
		pieces &= pieces - 1;
    &#125;

	pieces = PcBb&#40;p, side, R&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
		control = RAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
        mob  += PopCnt&#40;control&#41; * 2;
		att  += PopCnt&#40;att_zone&#41; * 3;
		wood_majors += 1;
        pieces &= pieces - 1;
    &#125;

	pieces = PcBb&#40;p, side, Q&#41;;
    while &#40;pieces&#41; &#123;
        from = FirstOne&#40;pieces&#41;;
        control = QAttacks&#40;OccBb&#40;p&#41;, from&#41;;
		att_zone = control & king_zone;
		mob  += PopCnt&#40;control&#41;;
		att  += PopCnt&#40;att_zone&#41; * 4;
		wood_majors += 3;
        pieces &= pieces - 1;
    &#125;

	// normalize for table size
    if ( wood_minors > 4 ) wood_minors = 4;
	if ( wood_majors > 5 ) wood_majors = 5;

	if ( att  > 23 ) att  = 23;
	if ( wood_majors == 0 && wood_minors < 3 ) att = 0;
	if ( wood_majors > 2 ) att = ( &#40;att * 3 ) / 2 );
	if ( wood_minors > 2 || wood_majors > 3 ) att = ( &#40;att * 5 ) / 4 );

    return mob + att;
&#125;
I am doing almost the same idea in my king safety code, with the only difference that instead multiplying the attacked zone count by only a fixed constant, I also use the square distance from the attacker piece to the opposite king. What do you think about that?