Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable chess evaluation function #14

Open
oggy22 opened this issue Jan 2, 2024 · 0 comments
Open

Customizable chess evaluation function #14

oggy22 opened this issue Jan 2, 2024 · 0 comments
Labels

Comments

@oggy22
Copy link
Owner

oggy22 commented Jan 2, 2024

Using templates and if const implement something like following:

template <
int material=1, //Qs*9+Rs*5+Bs*3+Ks*3+Ps*1
int almost_promoted=0, // white pawns on 7th rank - black pawns on 2nd rank
int king_protection=0, // count pieces around the king
int coverage=0, // count squares controlled by white - black
int legal_moves=0 // number of legal moves
>
int evaluate()
{
  int ret = 0;
  if const (material > 0) ret+= material * evaluate_material();
  if const (almost_promoted) ret+= almost_promoted * almost_promoted_evaluate();
  if const (king_protection) ret+= king_protection * king_protection_evaluate();
  if const (coverage) ret+= coverage * coverage_evaluate();
}
@oggy22 oggy22 added the chess label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant