Add a spawn block algorithm.

These commits add an intelligent algorithm that determines a good location for a spawn block. This fixes issue #457.