Sungorus 1.4

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

Moderators: hgm, Rebel, chrisw

Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Sungorus 1.4

Post by Pablo Vazquez »

bhlangonijr wrote:
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::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;
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,
Hi Ben-Hur,

In the past I didn't get very good results with LMR. The hard thing about it is finding the correct restrictions. Anyway, I'll try again to see if I can find a good configuration.

Regards
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: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;
Thanks for this patch Pawel. I'm going to start focusing on the evaluation, especially pawn structure and king safety (which is inexistent atm).
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Sungorus 1.4

Post by PK »

Ben-Hur, frankly speaking I haven't thought about Your solution. I remember doing it another way round in CPW-Engine - i.e. using only distance data, not but giving a bigger bonus for relevant files/ranks/diagonals. so I guess Your idea might be worth testing. actually the good thing about trying such changes in Sungorous is its exrremely compact code (= You see what You do at a glance).