+ 10
Chess AI
I am hoping to make a chess robot, but I need to think small first. If I were to make a chess game in python how could I get the computer to make intelligent moves (depending on previous moves)?
5 Answers
+ 17
You need a way to generate all possible legal moves in a given position. Then you can simulate them and look whether the position is better/worse than before.
Usually you'd do that not one move ahead but as many as possible.
To decide whether a position is good, you need to assign a number to a position by a so-called "heuristic". A simple way would be to count up the material on the board (bishop/knight = 3 pawns, rook = 5 pawns, queen = 9 pawns, king = 1000 pawns). Then you take your material minus your opponents and thats what you try to maximize for (higher = better!). You look at all the moves a couple moves deep and choose the one that has the best worst-case outcome (so you are assuming the opponent plays perfect)
There are many ways to make it more sophisticated but that's the basic workings of a chess AI.
+ 13
Sololearn created this chess engine contest few weeks ago, many people participated and came up with their solutions .
There are many discussions and codes here in the comments that might be helpful.
https://www.sololearn.com/learn/11610/?ref=app
+ 7
If I was courageous enough to even try, I'd probably start with the core issue: checkmate.
Empty board, two kings, one queen.
And then figure out how to make the computer finish me off, probably with a whole bundle of ifs and elses. ;-)
+ 1
Before making it,u have to be good at Neural networks.which will serve as neuron to the brain of the robot.Then if statements