Workshop › Battleship › Step 11 of 35
playerShoots(r, c) fires at the enemy's fleet, unless you already tried that square: shooting twice at the same square
would waste a shot.
```js
function playerShoots(r, c) {
if (myShots[r][c]) return
fire(enemyFleet, myShots, r, c)
}
```null counts as false, 'miss' and 'hit' as true: a square already tried makes return leave at once.enemyFleet and records the result in myShots.Write playerShoots above function drawSea(, followed by an empty line.
Skills: Game states
← Show the shots Tap to fire →