user25733: I have made a chess engine that can play a decent game of chess. Like a lot of engines it uses a minimax search algorithm with alpha-beta pruning. It uses this simple evaluation function to assign a score. The problem I have is that the engine does not attempt to go for checkmate. Against Stockfish, it will attempt to capture all the enemy pieces and then get a queen via pawn promotion, presumably to maximize its score. It sometimes stumbles upon a mate position, but it is more common to result in stalemate even with multiple pieces (queen, rooks, bishops) vs a lone king. I think this is because my algorithm currently only encourages maximizing the difference in score (white vs black) and has no concept of mate. One idea I had is increasing the piece value of the king to encourage mate. Are there any methods to encourage the engine to go for mate rather than a massive material imbalance?

user4418: 
Are there any methods to encourage the engine to go for mate rather
than a massive material imbalance?

Any reasonably sophisticated position evaluation function is going to give extra points for certain positional elements (passed pawns, advanced pawns, bishop pair, etc.) and deduct points for other negative positional elements (doubled pawns, isolated pawns, bad bishop, unsafe king, etc)
Obviously any halfway decent evaluation function is also going to handle positional elements like checkmate (add MAXINT), stalemate (assign 0.0), 3-fold repetition (0.0), 50 move rule (0.0), insufficient material (0.0), etc.
If all your evaluation function does is use piece values and nothing else then you still have a lot of work to do to have an engine that is any good.

25733: <p>I have made a chess engine that can play a decent game of chess. Like a lot of engines it uses a minimax search algorithm with alpha-beta pruning. It uses this <a href="https://www.chessprogramming.org/Simplified_Evaluation_Function" rel="nofollow noreferrer">simple evaluation function</a> to assign a score. The problem I have is that the engine does not attempt to go for checkmate. Against Stockfish, it will attempt to capture all the enemy pieces and then get a queen via pawn promotion, presumably to maximize its score. It sometimes stumbles upon a mate position, but it is more common to result in stalemate even with multiple pieces (queen, rooks, bishops) vs a lone king. I think this is because my algorithm currently only encourages maximizing the difference in score (white vs black) and has no concept of mate. One idea I had is increasing the piece value of the king to encourage mate. Are there any methods to encourage the engine to go for mate rather than a massive material imbalance?</p>
 4418: <blockquote>
<p>Are there any methods to encourage the engine to go for mate rather
than a massive material imbalance?</p>
</blockquote>
<p>Any reasonably sophisticated position evaluation function is going to give extra points for certain positional elements (passed pawns, advanced pawns, bishop pair, etc.) and deduct points for other negative positional elements (doubled pawns, isolated pawns, bad bishop, unsafe king, etc)</p>
<p>Obviously any halfway decent evaluation function is also going to handle positional elements like checkmate (add MAXINT), stalemate (assign 0.0), 3-fold repetition (0.0), 50 move rule (0.0), insufficient material (0.0), etc.</p>
<p>If all your evaluation function does is use piece values and nothing else then you still have a lot of work to do to have an engine that is any good.</p>
