how to traverse a grid of numbers using AB-pruning in C++?
Firstly I would like to accept that it is a homework que开发者_JAVA技巧stion , but then I know how to code AB-pruning from the algorithm of it . The problem is how to apply it on a grid of numbers where the game can go on in any direction (right , left , up and down ) , thus how will be the tree formed .
Sorry for being a bit vague here , if more info is required then do inquire , I will provide it .
You question is very vague so I can only guess what you are asking:
Are you talking about a game where the player can only move in one of those 4 directions on each turn? If that is the case, your Node will be an (x, y) position of your player on the grid, and each node will branch 4 times (once for each direction) plus maybe 1 if you can stay still.
You say you already know how to code AB-pruning, so is that enough?
精彩评论