crippa1337 / Pytteliten

Chess engine under 4kB
MIT License
15 stars 7 forks source link

better eval by PST ? #35

Closed tissatussa closed 1 year ago

tissatussa commented 1 year ago

while Pytteliten is still in development, i'd like to give some feedback about PST (Piece Square Tables) and the use of HCE (Hand Crafted Evaluation) in general, as fas as i understand these concepts. So this is not a real Issue, but i would like to discuss a bit with you.

in fact this Issue is a continuation of #26 where at the end you wrote Pytteliten will have PST soon.

i understand the famous basic techniques MinMax and Alfa-Beta pruning, although i never created an engine myself .. i can read most concerning code sources, i tweaked PST values for experience, etc.

my Rapid games (setting about 10 minutes) with Pytteliten show that it reaches depth 8 or 9 in most positions, but not more .. so the HCE will not 'see' some tactics and will not 'have' a strategical concept .. many simple engines have this limitation but still play a decent game .. so why does Pytteliten pick 1.h4 (or 1...h5) to start almost all of its games ? Is it due to the lack of PSTs ? I doubt it, your engine has some HCE logic, which should make the engine play a 'normal' opening, using the center and developing pieces ?

even at low depth an engine should be able to prune the legal move list in a realistic way, using its HCE rules .. i've always wondered how this could ever be working, because chess can have many position types : while discarding certain moves based on a (too) simple HCE at each ply, reaching higher depths will not give a better move !? How am i wrong here ?

also about PST i keep having this question : why are pawn structures not involved ? I can imagine it's hard to come up with a logical concept for this, but pawns are "the soul of chess", they can not go backwards and connect with eachother, they can be sacrificed for space and greater goods, and they may decide the game by promotion !

i know HCE can have rules for 'open lines', 'double pawn' etc. but my intuition says it's best to use some PST concept for only pawns .. i found the engine Pawn v1.0 has some "Basic pawn structure" feature and even a kind of NN with pawn structure data - you might want to read my https://github.com/ruicoelhopedro/pawn/issues/14

crippa1337 commented 1 year ago

Hi Tissa, thanks for the questions and insights.

your engine has some HCE logic

Pytteliten currently only has a materialistic evaluation function. No chess fundamentals beyond that are instilled into it.

Is it due to the lack of PSTs?

Right now, I'd say that PSTs are the best solution to solve positions where the engine cannot find a winning trade. This, for example, would likely prevent the starting 1. h4, as it provides the evaluation function with positional awareness.

reaching higher depths will not give a better move !?

Sure, improper pruning will result in higher depths that do not provide better moves, and that is something engine development revolves around quite a lot. The fine balance between over and under-pruning.

All the contributors to Pytteliten has a different engine that they mainly development and since the next TCEC 4K is quite a bit away, it isn't a priority for most to develop it, but I hope you'll be happy to see improvements to Pytteliten's play soon.