user13768: I am currently attempting to make a basic chess engine in Python (Learning some basic concepts), but for some reason the engine is suicidal and does not detect the scholars mate. I am using python-chess for the board because I am lazy, but I think the issue is my implementation of negamax? I've read on chessprogramming wiki but still can't figure out the issue.
Here is the code on GitHub: https://github.com/AggressiveBee15/LousyEngine

user825: I didn't run your code, but by just looking:

You should return the score when score >= beta. This is consistent to Wikipedia:


Note when alpha >= beta, Wikipedia returns the score, not beta.

Your code doesn't detect checkmate? I don't see how your engine can report Scholar mate without detecting checkmate.
Minor issue. The condition should be >= not >, but that shouldn't change anything.
What outputs did you get from: print('New good move ...?


13768: <p>I am currently attempting to make a basic chess engine in Python (Learning some basic concepts), but for some reason the engine is suicidal and does not detect the scholars mate. I am using python-chess for the board because I am lazy, but I think the issue is my implementation of negamax? I've read on chessprogramming wiki but still can't figure out the issue.</p>

<p>Here is the code on GitHub: <a href="https://github.com/AggressiveBee15/LousyEngine" rel="nofollow noreferrer">https://github.com/AggressiveBee15/LousyEngine</a></p>
 825: <p>I didn't run your code, but by just looking:</p>

<ul>
<li>You should return the score when <code>score &gt;= beta</code>. This is consistent to Wikipedia:</li>
</ul>

<p><a href="https://i.stack.imgur.com/IPAgu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPAgu.png" alt="enter image description here"></a></p>

<p>Note when alpha >= beta, Wikipedia returns the score, not beta.</p>

<ul>
<li>Your code doesn't detect checkmate? I don't see how your engine can report Scholar mate without detecting checkmate.</li>
<li>Minor issue. The condition should be <code>&gt;=</code> not <code>&gt;</code>, but that shouldn't change anything.</li>
<li>What outputs did you get from: <code>print('New good move ...</code>?</li>
</ul>
