3.4.9 Battleships Jun 2026

Since you have three length-4 ships, look for rows that have a clue of exactly 4 . That row might be entirely occupied by a single Battleship. Check the column sums. If column A has a 1 and column B has a 1 , a battleship cannot sit there because a length-4 ship would cover 4 columns.

0 | ~ ~ ~ ~ ~ 1 | ~ ~ ~ ~ ~ 2 | ~ ~ ~ O ~ 3 | ~ ~ ~ ~ ~ 4 | ~ ~ ~ ~ ~ ... Hit! You sank my battleship! You won in 7 guesses. 3.4.9 battleships

Here is the completed Battleship class as required by the assignment: Since you have three length-4 ships, look for

Once you place a ship segment, immediately mark the eight surrounding cells as water (using an x or . ). In a dense puzzle like 3.4.9, this creates powerful chain reactions. For example, if you place a Cruiser horizontally in cells (5,5), (5,6), (5,7), you must mark (4,4), (4,5), (4,6), (4,7), (4,8) and (6,4) through (6,8) as water. If column A has a 1 and column

When stuck on a 3.4.9 puzzle, use . Because ships are all length 3 or 4 (odd and even), look at a column with a high sum, say 6 . If that column has water cells at rows 2 and 7, the remaining rows (1,3,4,5,6,8,9,10) must contain 6 ship segments. Since ships cannot be adjacent, the gaps between them must be an odd number of water cells. Calculating parity will often reveal an impossible placement.

class by implementing logic that determines how a ship takes damage based on an attacker's power level. The Objective You must complete two specific methods in the Battleship isAttacked stillFloating