Tapered Eval in Fruit

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Tapered Eval in Fruit

Post by gflohr »

I am trying to understand the implementation of Tapered Eval in Fruit: https://www.chessprogramming.org/Tapere ... on_example

PawnPhase is 0 there, and therefore all multiplications with PawnPhase are useless, and actually TotalPhase is just 24 and not 256 like the code suggests, hence the phase is between 0 and 24.

I have also checked the sources of Fruit and it looks like the copy of it in the wiki is correct.

Did I miss something here?
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: Tapered Eval in Fruit

Post by Desperado »

gflohr wrote: Thu Sep 16, 2021 1:25 pm I am trying to understand the implementation of Tapered Eval in Fruit: https://www.chessprogramming.org/Tapere ... on_example

PawnPhase is 0 there, and therefore all multiplications with PawnPhase are useless, and actually TotalPhase is just 24 and not 256 like the code suggests, hence the phase is between 0 and 24.

I have also checked the sources of Fruit and it looks like the copy of it in the wiki is correct.

Did I miss something here?
I guess this will provide you the answer.
Especially this part
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Tapered Eval in Fruit

Post by op12no2 »

The last line of the code you linked to scales phase to [0,256] assuming integer arithmetic. I would guess because phase changes slower than eval is called, so you can use shifts in eval not division for the tapering.
Last edited by op12no2 on Thu Sep 16, 2021 8:57 pm, edited 1 time in total.
gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: Tapered Eval in Fruit

Post by gflohr »

Desperado wrote: Thu Sep 16, 2021 8:04 pm I guess this will provide you the answer.
Especially this part
Thanks! That's what I missed to find.
gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: Tapered Eval in Fruit

Post by gflohr »

op12no2 wrote: Thu Sep 16, 2021 8:48 pm The last line of the code you linked to scales phase to [0,256] assuming integer arithmetic. I would guess because phase changes slower than eval is called, so you can use shifts in eval not division for the tapering.
But doesn't that essentially ignore the number of pawns on the board?
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Tapered Eval in Fruit

Post by op12no2 »

gflohr wrote: Thu Sep 16, 2021 8:58 pm But doesn't that essentially ignore the number of pawns on the board?
Yes, using that scheme they don't contribute to phase. But you can try other values and see what happens...
gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: Tapered Eval in Fruit

Post by gflohr »

op12no2 wrote: Thu Sep 16, 2021 9:00 pm
gflohr wrote: Thu Sep 16, 2021 8:58 pm But doesn't that essentially ignore the number of pawns on the board?
Yes, using that scheme they don't contribute to phase. But you can try other values and see what happens...
Okay, but why? Aren't 16 pawns on the board very middle-game and zero very end-game?
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Tapered Eval in Fruit

Post by op12no2 »

gflohr wrote: Thu Sep 16, 2021 9:09 pm Okay, but why? Aren't 16 pawns on the board very middle-game and zero very end-game?
I don't think there is a good answer other than it seems to work; amongst probably endless other schemes (some including pawns) that also work. The weights can also be tuned, so pick something that seems sensible to you and then tune later perhaps.
gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: Tapered Eval in Fruit

Post by gflohr »

op12no2 wrote: Thu Sep 16, 2021 9:23 pm
gflohr wrote: Thu Sep 16, 2021 9:09 pm Okay, but why? Aren't 16 pawns on the board very middle-game and zero very end-game?
I don't think there is a good answer other than it seems to work; amongst probably endless other schemes (some including pawns) that also work. The weights can also be tuned, so pick something that seems sensible to you and then tune later perhaps.
I will try to update the wiki. And kudos for Lozza, btw. :)
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Tapered Eval in Fruit

Post by op12no2 »

gflohr wrote: Thu Sep 16, 2021 9:29 pm I will try to update the wiki. And kudos for Lozza, btw. :)
Cheers Guido, Lozza is a fun background project...