We consider the problem of reconfiguring a modular self-reconfigurable robots (MSRs) in the presence of uncertainty due to operational limitations of the robot and dynamic nature of the environment. We employ a coalition game theory-based technique to address this problem by representing a configuration of the modules as a coalition structure and finding the 'best' configuration by searching for the optimal coalition structure. The key contribution of this paper is to speed up the search by making the observation that the maximum size a group or coalition of modules can have is limited to a maximum value, n max, which is determined by the operational and mobility constraints of the modules. We then propose an anytime algorithm called BlockPartitioning that uses integer partitioning along with an intelligent pruning technique to reject coalitions that are infeasible either due to their excessive size or due to excessive cost of coming together under current operational conditions. We have provided analytical results for our algorithm and also simulated it with different number of modules and different values of the maximum coalition size of an MSR called ModRED, and, shown that our algorithm takes nominal time to find the optimal solution (less than 1 sec. for up to 12 modules).