… | |
… | |
2163 | |
2163 | |
2164 | return 3; |
2164 | return 3; |
2165 | } |
2165 | } |
2166 | |
2166 | |
2167 | /* |
2167 | /* |
2168 | * absdir(int): Returns a number between 1 and 8, which represent |
|
|
2169 | * the "absolute" direction of a number (it actually takes care of |
|
|
2170 | * "overflow" in previous calculations of a direction). |
|
|
2171 | */ |
|
|
2172 | |
|
|
2173 | int |
|
|
2174 | absdir (int d) |
|
|
2175 | { |
|
|
2176 | while (d < 1) |
|
|
2177 | d += 8; |
|
|
2178 | |
|
|
2179 | while (d > 8) |
|
|
2180 | d -= 8; |
|
|
2181 | |
|
|
2182 | return d; |
|
|
2183 | } |
|
|
2184 | |
|
|
2185 | /* |
|
|
2186 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2168 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2187 | * between two directions (which are expected to be absolute (see absdir()) |
2169 | * between two directions (which are expected to be absolute (see absdir()) |
2188 | */ |
2170 | */ |
2189 | |
|
|
2190 | int |
2171 | int |
2191 | dirdiff (int dir1, int dir2) |
2172 | dirdiff (int dir1, int dir2) |
2192 | { |
2173 | { |
2193 | int d; |
2174 | int d; |
2194 | |
2175 | |