Readme.Txt
Ahenobarb's search functions.  4/12/2003

This file contains two new SLIC search functions: GetTile and GetTile1.  

-------------------------------------------------------
GetTile:

Similar to the GetNeighbor search the comes with CTP2, GetTile searches the 
immediate 8 tile surrounding the search area.  However, you can send different
numerical flags to the function to change the direction of the search.  The 
syntax for the function is:

1.   GetTile([location], [number], [direction]);

                [location]:  This is the location around which you want to search
                [number]:    This is the tile number that you want to search, there
                are 8 tile surrounding the location.  You should use
                a FOR loop (i < 8) to get different tile numbers.
                [direction]: Controls the direction of the search.  The directions are explained below.

2.   After the function has been called, set the value of your user-defined location variable 
     to that of the global variable GT0_RetLoc.  This gives you the location of the tile 
     currently being examined.

	tmpLoc = GT0_RetLoc;

Example:
	for (i = 0; i < 8; i = i + 1) {
		GetTile(amry[0].location, i, 4);
		tmpLoc = GT0_RetLoc;
		if (TileHasImprovement(tmpLoc)) { ... do stuff ... }
	}


GetTile flags:

	X axis centered searches:
		0 - Regular GetNeighbor (Left to Right, Top to Bottom)
		1 - Right to Left, Center to Top:

                                2
                              4   1
                            7   x   0
                              6   3
                                5

		2 - Right to Left, Top to Bottom:

                                0
                              1   3
                            2   x   5
                              4   6
                                7

		3 - Left to Right, Center to Top:

                                2
                              1   4
                            0   x   7
                              3   6
                                5

	Y axis centered searchs:
		4 - Right to Left, Top to Bottom:

                                0
                              2   1
                            4   x   3
                              6   5
                                7

		5 - Left to Right, Top to Bottom:

                                0
                              1   2
                            3   x   4
                              5   6
                                7

		6 - Right to Left, Bottom to Top:

                                7
                              6   5
                            4   x   3
                              2   1
                                0

		7- Left to Right, Bottom to Top:

                                7
                              5   6
                            3   x   4
                              1   2
                                0

	Spiral Searches:
		8 - Clockwise from Top:

                                0
                              7   1
                            6   x   2
                              5   3
                                4

		9 - Counter-Clockwise from Top:

                                0
                              1   7
                            2   x   6
                              3   5
                                4

		10 - Clockwise from bottom:

                                4
                              3   5
                            2   x   6
                              1   7
                                0

		11 - Counter-Clockwise from bottom:

                                4
                              5   3
                            6   x   2
                              7   1
                                0

		Polar searches: [Unimplemented]

-------------------------------------------------------

GetTile1

GetTile1 is an expanded search engine that searches all of the tiles available
to a city after its first border expansion.  It can search all of the tiles 
indicated below with "o", "x" is the city location.

                              0   0
                            0   0   0
                          0   0   0   0
                            0   x   0
                          0   0   0   0
                            0   0   0
                              0   0
               
The syntax for the search is:

1.   GetTile1([location], [number], [direction]);

                [location]:  This is the location around which you want to search
                [number]:    This is the tile number that you want to search, there
                are 8 tile surrounding the location.  You should use
                a FOR loop (i < 20) to get different tile numbers.
                [direction]: Controls the direction of the search.  The directions are explained below.

2.   After the function has been called, set the value of your user-defined location variable 
     to that of the global variable GT1_RetLoc.  This gives you the location of the tile 
     currently being examined.

	tmpLoc = GT1_RetLoc;


GetTile1 flags:

	X axis centered searches:

		0 - Left to Right, Top to Bottom:

                              3   0
                            8   4   1
                         12   9   5   2
                            13  x   6
                         17   14  10  7
                           18   15  11
                             19   16

		1 - Right to Left, Center to Top:

                              7   2
                           11   6   1
                         16  10   5   0
                           15   x   4
                         19  14   9   3
                           18  13   8
                             17  12

		2 - Right to Left, Top to Bottom:

                              0   3
                            1   4   8
                          2   5   9   12
                            6   x   13
                          7   10  14  17
                            11  15  18
                              16  19

		3 - Left to Right, Center to Top:

                             2   7
                           1   6   11
                         0   5   10   16
                           4   x   15
                         3   9   14   19
                           8   13   18
                             12   17

	Y axis centered searches:

		4 - Right to Left, Top to Bottom:

                              1   0
                            4   3   2
                         8    7   6   5
                            10  x   9
                         14   13  12  11
                           17   16  15
                             19   18


		5 - Left to Right, Top to Bottom:

                              0   1
                            2   3   4
                         5    6   7   8
                            9   x   10
                         11   12  13  14
                           15   16  17
                             18   19

		6 - Right to Left, Bottom to Top:

                              19  18
                            17  16  15
                          14  13  12  11
                            10  x   9
                          8   7   6   5
                            4   3   2
                              1   0

		7 - Left to Right, Bottom to Top:

                              18  19
                            15  16  17
                         11   12  13  14
                            9   x   10
                         5    6   7   8
                            2   3   4
                              0   1

	
	Spiral Searches:
		8 - Clockwise top to bottom:

                             11   0
                           10   12  1
                         9   19   13   2
                           18   x   14
                         8   17   15   3
                           7   16   4
                             6    5

		9 - Counter-Clockwise Top to Bottom:

                             0    11
                           1    12  10
                         2   13   19   9
                           14   x   18
                         3   15   17   8
                           4   16   7
                             5    6


		10 - Clockwise Bottom to Top:

                             5    6
                           4    16  7
                         3   15   17   8
                           14   x   18
                         2   13   19   9
                           1   12   10
                             0    11

		11 - Counter-Clockwise Bottom to Top:

                             6    5
                           7    16  4
                         8   17   15   3
                           18   x   14
                         9   19   13   2
                           10   12   1
                             11   0

	Polar Searches: [unimplemented]


