DEV Community

Discussion on: Build a Simple Chess AI in JavaScript

Collapse
 
jeffprod profile image
JeffProd

Good explanations.
But, I think that as the king can't be taken (the game is over on the previsous move), there is no need to set a high score for the piece. If you set it to 0 it is the same.

Collapse
 
promikecoder2020 profile image
ProMikeCoder2020

He has to so the AI minimax algorithm prioritizes the king