improve implementation of generateMinePosition