Game Development Reference
In-Depth Information
line that will exist then, but there is no point in waiting for them. At any point in
the game, five is enough to see the next break if one exists.
Then the look-ahead checks to see if the game it was passed in wins for one side or
the other. It is not an error for this to happen here, but it certainly terminates the
search for good or ill. If the fox is still in the game and looking ahead, it needs to
break the line. Fox moves by themselves do not break the line. A fox move can
force the hounds to break the line, but it is always a hound's move that opens any
hole. So the look-ahead asks the hounds to make their next move so that the fox
can see if it has forced a hole.
Before your brain melts, remember that when the fox is looking ahead from
behind an unbroken line, the hounds know exactly what to do. They know to
keep the line intact if they can and squeeze the fox out of squares it can move to.
Failing that, they know that of the moves that break the line, the one that puts the
hole the farthest from the fox is best. The hounds do not need to use look-ahead
to do this.
If the hounds' best move breaks the line, the fox knows that this is a great move,
so it returns as a result the board provided by the hounds that shows them
breaking their line. The look-ahead was able to say, ''This is the best result of the
move you gave me.'' If the hounds did not break their line, then the look-ahead
asks the fox to return the future result of their best countermove by calling Fox2()
with a False parameter, indicating that the look-ahead wants a result, not a
move. The fox will spread out a tree at most five fox moves deep into the future,
looking for boards that break the line.
We mentioned the calming fact that the hounds do not need to look ahead when
the fox is looking ahead. This happens to be true for us, and that heuristic goes a
long way to manage computational complexity, but it is not really required. The
task might not be suitable for beginners, but with careful analysis, the code can be
changed to accommodate both sides looking ahead at the same time. Search
depth limits still work, but a problem can arise. If the fox is looking ahead past
when the line is broken, it will see that in the future the line will be reformed. At
one point it will decline to take the early break in the line in favor of a later break
because with the later break it cannot see far enough into the future to see the
hounds reforming the line after the later break. With the early move, it sees
freedom followed by enclosure, and with the later move it sees freedom but can't
see the enclosure that surely follows. A sure cure to this is to let the fox see the
future all the way to the end. This is computationally expensive, and in this
Search Nedrilad ::




Custom Search