Code:

template<int NDim1, int NDim2, typename BoardData_t>
int GetBestMove(SMinMaxSharedData<NDim1, NDim2>& SharedData, SMinMaxVolatileData<NDim1, NDim2, BoardData_t>& VolatileData, const Player& CurrentPlayer,
uint Level, int Alpha, int Beta/*, unsigned int StartPos, unsigned int EndPos*/
#ifdef DEBUG_OUTPUT
, SDebugData& DebugData, double CurrentProgress, double PercentageWorth
#endif
)
{
X_t x(0);
Y_t y(0);
int BestScoreSoFar;
typedef const Board<NDim1, NDim2> Board_t;
SAlgoData<NDim1, NDim2, BoardData_t> Data = Initialize<NDim1, NDim2, BoardData_t>(CurrentPlayer, VolatileData, SharedData, Level, Alpha, Beta, PercentageWorth, DebugData, x, y, BestScoreSoFar);
typedef std::pair<int, Coordinates> Score_t;
struct greater
{
bool operator () (const Score_t& score1, const Score_t& score2) { return score1.first > score2.first; }
};
typedef std::multiset<Score_t, greater> Set_t;
Set_t Scores;
UpdateDebugBoard(Data);
if ( HandleDraw(Data) )
return 0;
if ( HandleMaxDepth(Data) )
return 0;
if ( HandlePlayerHasWon(Data) )
return GetPlayerWinPts(Data);
for (x = X_t(0); x < Board_t::Width; x++)
{
for (y = Y_t(0); y < Board_t::Height; y++)
{
if (!VolatileData.Board.IsSquareEmpty( Coordinates(x, y) ))
continue;
Scores.insert(
std::make_pair
(
detail::FindNumSurroundingData(Data.VolatileData.Board, Data.CurrentPlayer, Coordinates(x, y)) * (Data.IsComputer ? 1 : -1),
Coordinates(x, y)
) );
}
}
auto score_it = Scores.begin();
for (unsigned int i = 0; score_it != Scores.end(); ++score_it, i++)
{
#ifdef DEBUG_OUTPUT
double NumIterations = (double)i;
DebugData.Progress = CurrentProgress + NumIterations * Data.LoopPrcUnit;
UpdateDebugBoard(Data);
Data.DebugData.ExaminedNodes++;
#endif
VolatileData.Board.SetSquare(score_it->second, CurrentPlayer);
UpdateDebugBoard(Data);
Data.MovesLeft--;
Data.FreeSquares--;
int Score = score_it->first;
typename SCORE_LOOKUP_MAP_T::const_iterator it;
bool InMap = HandleIsInMap(Data, it);
Score += GetScore(Data, InMap, it);
SaveScoreInMap(Data, InMap, Score);
VolatileData.Board.UndoLastMove();
Data.FreeSquares++;
SaveBestScoreSoFar(Data, Score, score_it->second);
if (HandlePruning(Data))
break;
}
VolatileData.OutCoord = Data.BestMoveSoFar;
#ifdef SHOW_PREDICTED_MOVES
VolatileData.PredictedMoves[Level - 1] = BestMoveSoFar;
#endif
return Data.BestScoreSoFar;
}

Perhaps I need to improve the algorithm for calculating how many points it gets?