Inventions for making ships pirate resistent should be arriving shortly. Bear in mind: The easiest access to a ship is from the stern. the cost needs to be low the device should not be overtly lethal.