Share your repls and programming experiences

← Back to all posts
I built a chess engine in java!
KennethWilber (2)

im new to programming, and this was my first serious project!

Rishan001 (43)

This is legit! How did you do it, without revealing anything in your answer?

KennethWilber (2)

@Rishan001 sorry idk what you mean by without revealing anything in my answer, but basically how it works is it generates a list of legal moves. Then loops through that list, making and undoing each move. Before undoing however the function calls itself again recursively. This goes until a certain preset depth. Then with all those possibilities, it calculates each position's value (mostly in material) and decides what move is best assuming both players try to maximize their own material advantage.