Whensuccessfullyplacingashipdothefollowing1findthemaxi

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: member that if a ship is facing north, or[ the rest of the ship is to the south of the bow. A ship may not go over the edges of the grid, and may not occupy an already occupied space. How a ship is represented in the grid will be described later. each ship will have a unique index ­ described below. Returns the index of the placed ship, if the placement was successful, and 'None' otherwise. If ship placement was not successful, the board should not have been modified. Assignment 4c: Implement f r , a function with 2 arguments: The b a d to fire on, and a tuple (x,y) ie or representing the t r e o fire on. If the target is an illegal target, return None. agtt Otherwise returns atuple (hit,ship), where hit is True/False depending if the the shot hit, and ship is the index of the ship which was completely destroyed, or 0 if no ship was completely destroyed. Each cell in the grid contains one of the following: 1. None, if the cell has no ship. 2. A tuple (index,part,[size]), where index is the index of the s...
View Full Document

Ask a homework question - tutors are online