How can minimax chess engines do alpha-beta pruning without reaching the final positions? In order to calculate far ahead, minimax chess engines must perform alpha-beta pruning, where they don't calculate positions that are obviously winning or obviously losing. Without doing pruning, engines would have to deal with over a billion positions in the first 4 moves / 8 ply of the game.

My question is how do minimax engines perform alpha-beta pruning without evaluating the final positions? How does an engine know whether a position is completely won / lost without calculating as deep as it can go? For example:


e4 e5 2. Nf3 d6 3. Bc4 Bg4 4. Nc3 Nc6 5. h3 Bh5 6. Nxe5 Bxd1


At this point, White's two moves away from checkmate. Assuming the engine wasn't aware of the Legal's Mate, wouldn't it apply Alpha-Beta pruning and just stop calculating at this point, assuming the position is won for Black?

I'm aware of quiescence search, where the engine won't stop calculating until the position is considered "quiet". In this position, White is able to play Bxf7+ and Black's King is in danger, so this position wouldn't qualify as a quiet position.

But if an engine has to perform quiescence search everytime it needs to decide whether to perform Alpha-Beta pruning and stop calculating further, doesn't this defeat the purpose of pruning in the first place? Since you need to calculate ahead to check to see if you don't need to calculate ahead.

EDIT: There are two answers to this question that I found very useful. Look at SmallChess' answer for info on issues with the depth-limit of engines' calculations. See RemcoGerlich's answer for an excellent description of what Alpha-Beta pruning is. When I wrote this question I didn't truly know what it was.
If a chess engine isn't aware of the mate, then it will be happy to play the moves as Black. By the time it sees the checkmate, it'd be too late. Game over. 1-0.
Fortunately, your scenario is quite simple. A good engine should have sufficient depth to see the mate. The iterative deepening depth-first algorithm will allow searches with increasing depth limits: d,d+1,d+2,d+3... I believe any decent chess engine should be able to handle it, it's not a very deep search.
While your example is simple, pruning does cause problems for tactical positison. Take a look at Chessbase's article:

https://en.chessbase.com/post/houdini5tacticalmode
...Suppose there is a complicated position in which you just feel there must be a tactic. You could be right, but sometimes even the monster engines can miss it at first...

&quot;Tactical mode&quot; is a fantasy term for applying passive pruning.