On fox hunting are often several hunting dogs chasing a fox . In this project
we make a program that simulates the fox hunting in an area that looks like
chess board, ie area is divided into rectangular tiles . In each iteration , both the
fox and hounds moved in one of eight adjacent squares , ie if
the fox is on the field ( 4.7 ) it can go on any of the fields
( 3,6 ) , ( 3,7 ) , ( 3,8 ) , ( 4,8 ) , ( 5,8 ) , (5,7 ) , ( 5,6) , ( 4,6 ) in the next step . The fox always choose
on a field that moves far from the hunting dog that is closest to him .
Hounds can be moved in the same way as the fox , and always choose the field that
closest solids. Distances are calculated as the crow flies distance, ie with
Pythagoras . If there is a tie between the boxes you can hire any field
adopted. The goal of the fox to come off the board while targets
hunting dogs is to achieve solids before he gets away . There may be more than
a hunting dog in the same field . The fox starts to move , then move the dogs themselves .
The content of the program is as follows. First, there are two numbers . The first number indicates the
the size of the table, ie how many blocks are in each row and each column
(this is the nxn board) and the second number is the number of the Sporting . Thereafter
establish pairs of numbers , the first pair indicates the location fox ( (x , y ) coordinates ), and
so bring pairs of numbers that indicate the location of hunting dogs ( (x , y ) coordinates
for each hunting dog.
The program itself iterations through the game and find out if the fox gets out in a timely
time , or whether the hounds catch him. If the fox escaping from the board to
print "Escape ! " but another to print " Caught " .
Since we do not know in advance how many hounds are then
require the use of liquid matrix in this example . It is not necessary to print
the table itself and the situation but it is very likely that it will help to debugga
the program .