Excercise 1 - Battleships Game
Excercise 1 - Battleships Game
Battleships is a classic two-player game where the objective is to sink your opponent's fleet of ships
before they sink yours. Each player places a set of ships on a grid and takes turns guessing the
locations of the opponent's ships. When a player correctly guesses a location, it is marked as a hit;
otherwise, it is marked as a miss. Points are awarded based on the number of cells occupied by each
ship.
To do:
Create an interactive and visually appealing Battleships game in Excel. Use your Excel skills to design
the game grid, apply conditional formatting, and set up formulas to track player scores.
Instructions:
o Create a 10x10 grid starting from an appropriate position on your Excel sheet (e.g.,
starting from cell B5).
o Format the grid cells with a light blue fill colour to represent water and add borders
to each cell.
o Randomly place ships on the grid by entering the number "1" in cells representing
ship locations.
o Ensure ships are placed horizontally or vertically and follow the scoring guide for the
number of cells each ship occupies.
Create a section to calculate and display the scores for each player.
Hint 1: Use the COUNTIF function to count the number of hits for each player. For
example, =COUNTIF(B7:K16, "1") will count the cells containing "1" in the game grid.
Hint 2: Use the IF function to calculate points based on ship sizes. For example, you can
use a formula like =IF(CELL="1", POINTS, 0) to assign points for each hit based on the
ship size.
Combine these functions to update the scores dynamically as the game progresses.