This application presents a grid of 100 squares to the user. The user has thirty five attempts to find to find the computers fleet. The computer randomly positions five ships of varying sizes around the board.The board is made up of 100 buttons each uniquely numbered. They start sea-green indicating not selected. When selected the application checks if the area is occupied and turns red if unoccupied turns blue. The application also emits an explosion for a hit and a splash for a miss. It also recognizes a complete sinking by ringing the ships bell. On complete sinking of a ship it's corresponding ship indicator turns yellow.After 35 attempts the application will show all missed squares by turning the squares yellow.It uses the following......wav files for all the soundsButtons for the squaresRandom method to place the shipsUse manager to organise the squaresI have included the code and wav files in the following zip file (See attached file: BattleBoat.zip)You will notice three classes - Battleship, GridManager and MainForm.The Mainfrom is the entry point for the application. It initializes the application and controls play.GridManager manages the grid. It adds the ships. Controls the current condition of the buttons.Battleship - holds information about each ship. It tells the condition of the ship e.g. if it has sunk or wrecked etc, it holds the type, name and length of the shipYou might note I have used the random method twice before I assign the ship. This was the only way to ensure complete randomization. If I used it once then it seems to position the ships very close together.
Gym Exercise Tracker in C# and .NET - Printing the DataGridView
Image Resizing : Part II