A step-by-step guide to building a simple chess AI – freeCodeCamp
Using these libraries will help us focus only on the most interesting task: creating the algorithm that finds the best move. We'll start by creating a function that just returns a random move from all of the possible moves: Although this algorithm isn't a very solid chess player, it's a good starting point, as we can actually play against it: Now let's try to understand which side is stronger in a certain position. With the evaluation function, we're able to create an algorithm that chooses the move that gives the highest evaluation: The only tangible improvement is that our algorithm will now capture a piece if it can. Next we're going to create a search tree from which the algorithm can chose the best move. This is done by using the Minimax algorithm.
Jun-26-2017, 20:55:17 GMT