jhonnold / berserk

UCI Chess Engine written in C
GNU General Public License v3.0
200 stars 30 forks source link

Segmentation Fault #498

Closed ellxor closed 11 months ago

ellxor commented 11 months ago

Berserk segfaults when analysing a position with more than 128 moves, such as: FEN: 3Q4/1Q4Q1/4Q3/2Q4R/Q4Q2/3Q4/1Q4Rp/1K1BBNNk w - -

This position has 218 legal moves which is considered to be the most of any legal position (that anyone has constructed so far...)

I believe a simple fix is to redefine MAX_MOVES from 128 to 218 in types.h- at least that worked for me after a brief check. Obviously this will likely make a small reduction in engine performance for the sake of full legal completeness. Maybe this is something you have already considered, but I did find a position in lichess elite database from a real game with more than 128 legal moves.

jhonnold commented 11 months ago

but I did find a position in lichess elite database from a real game with more than 128 legal moves.

What is that position?

ellxor commented 11 months ago

I don't have an exact FEN or link to the game, but one player had promoted to 8 queens in an endgame.

jhonnold commented 11 months ago

Alright, I'm not too concerned about that happening in an Engine v Engine match, where engines play for mate rather than bad manners :)