Skip to content
← Back to Community
I built a chess engine in java!
Profile icon
KennethWilber

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

Voters
Profile icon
TheNoobinator
Profile icon
Brendan23
Profile icon
Rishan001
Profile icon
KennethWilber
Comments
hotnewtop
Profile icon
Rishan001

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

Profile icon
KennethWilber

@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.