Animated Algorithm

This problem has been bugging me: how can I determine with certainty if a ship of a given size can fit on the board? So far, I've learned how to use JavaScript's setTimeout function to visualize the algorithm I just started writing. Cool, huh? There's much so more to do, though!