How to make an "computer player"

Hey there! I’m trying to make a “computer player” for a chess type strategy game, and I was wondering if you guys could give me some ideas on how to approach this. I have no experience whatsoever that’s why. (Like how the ai chooses which piece to move, which piece it wants to attack, moving their pieces, e.t.c) Please let me know if there is a useful video on this

Thanks

The algorithm you want to use for this is the Minimax algorithm. This allows you to choose the best of possible options.

Think about chess in terms of predicting what your opponent is trying to do, and being a few steps ahead of them. Your computer is extremely fast at calculations, but extremely bad at understanding. So, you need to abstract the problem in a way that is easy to calculate.

Assign a weight to each piece (i.e. a “capture value”). Then, run through every possible move you can make, and figure out which one has the greatest composite score (i.e. least risk, highest reward).

With more computational power, you could even go down this tree algorithm and try to map out an “end game” (i.e. create many strategies to win) and then pick those strategies based on what the players moves are. That’s sort of like a “stretch goal” though - the sort of thing people do for their honours projects.

4 Likes

Interesting… Thanks for the help!

1 Like

Only thing is, I don’t know how to input that the roblox, I understand the concept

Hey, sorry for bumping the topic. I have not figured out an answer on how I imply the Minimax into roblox. Help appreciated