Added new heuristic function for arbitrarily-sized games.