Implement buyShip function