Laboratory Walkthrough 4

# Whensuccessfullyplacingashipdothefollowing1findthemaxi

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

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

## This document was uploaded on 03/20/2014 for the course CMSC 67101 at Hebrew University of Jerusalem.

Ask a homework question - tutors are online