Quote Originally Posted by eugeneloza View Post
yes, that's possible, but I'm afraid optimizations will obfuscate the code.
I'm aware of that. That is why I suggested using combination of current and optimized approach based on certain condition. This would allow people to know that optimization is optional.
But regardless you should notify people that would potentially use your code about possible caveats that such code represents.

Quote Originally Posted by eugeneloza View Post
Still it'll have to test only 16*16*sqrt(2) combinations in average to find the last remaining tile to place a rabbit, i.e. 360 tests, which is affordable.
I'm afraid your math won't hold. Why? Because it is quite possible that your random algorithm would generate same pair of X and Y coordinates multiple times. Now why is that? When generating random numbers most random number algorithms internally generate random floating value between 0 and 1 and then this number is linearly translated to integer value where internal value of 1 would be translated to maximum integer value you specified. This results in rounding the internal number at some time which means that several near floating numbers would translate to same output integer value and thus also the possibility for generating same pair of output values.

Quote Originally Posted by eugeneloza View Post
The other problem is that it will hang up the next moment when there are no free tiles left
Easy solution.
If your snake size equals to the number of all tiles on the map "Congratulations you won the game"