I’m currently working on a “dots and boxes” program where the input is automatically generated by a computer, and our output is what move we’ll make. I’ll be competing against another player (their algorithm).
I’m representing the dots and boxes board as a matrix in Python. Winning the game is top priority: algorithm efficiency is not that important.
Is there a best, not complex algorithm for automatically figuring out what move we should make, given a board?
P.S. – You don’t need to give me anything in code if you want…English algorithms are perfectly acceptable.
This game is zero sum game, so I’d suggest using the min-max algorithm for it. This algorithm was used by deep-blue to win Kasparov in chess.
Create your heuristic function, which evaluates each state of the game, and use it as the evaluation function of min-max algorithm.
You can also improve min-max by using alpha-beta prunning.
The idea of min-max is to exhaustively search all possible moves [up to certain depth usually, since the states you need to go over is exponential in the number of depth], and chose the best move, assuming your oponent is also going to make his best possible move.
p.s.
They are strongly connected together, since the more efficient your algorithm is, you will be able to check the possible solutions up to better depth, and the better chances you will have to win. Note that with unlimited time, you can explore the whole game tree and come up with a winning strategy from each game state. However – exploring the whole game-tree is probably unrealistic.