Rewrite AI ship placement (including bug fix)

There was a bug in the AI ship placement code: If the first few ships had been
placed in an unfortunate way, the function failed to terminate because there
was no allowed way to finish the fleet. I have now implemented backtracking to
fix this problem.