More Algorithmic Adventures

I think I finished my algorithm that tests whether a ship can fit on the board! There's still a bug, though. Can you spot it? (This is what I get for writing code while half-asleep.)