B. List of Files - SwinbeeMiles/MyBattleship GitHub Wiki

Documented by: Zikri Dawek

Within the directory for the game (which is referred to as version 1.0 by Team Delta/02-team06), several folders can be found that are responsible for running the game, and it is of utmost importance that these folders and files must be kept as they are in order for the game to function as intended. The following image is a snapshot of the folder structure for the game:


  1. "Bin"

Within the “Bin” folder is the “Debug” folder which contains the necessary files for the game to be executed without the need for the source code. This allows the game to be shared as a stand-alone software. Along with the executable file for the game is the “Resources” folder which contains the assets that the game depend on.


  1. "Lib"

The “Lib” directory contains the necessary Swingame library, that is the SwinGameSDK, that the game operates on. The following image is a snapshot of the folder structure within the “Lib” directory.


  1. "Resources"

Similar to the “Resources” folder within “Bin”, the “Resources” directory is responsible for storing the assets that game rely on to function. The difference being is that the source code, which will be discussed after this, relies on assets stored in these assets as the game is programmed to fetch its assets from this directory.


  1. "Src"

Within the “Src” folder are where the Visual Basic codes are stored in that is responsible for the game’s execution and how it behaves.

The following list are the files that are responsible for how the game behaves:

  • DeploymentController.vb – This file is responsible for controlling the player’s actions during deployment phase.
  • DiscoveryController.vb – This file is responsible for handling the battle phase between the player and the computer player.
  • EndingGameController.vb – This file is responsible for managing the interactions at the end of a game.
  • GameController.vb – This file is responsible for how the game controls, as well as managing user input, and displaying the current state of the game.
  • GameLogic.vb – This file contains the main logic in how the game should be run when it is executed. It is notable that the game loop logic is stored in here as well.
  • GameResources.vb – This file is responsible for loading in the assets from the “Resources” folder that are required by the game to function. These assets range from images to sounds.
  • GameState.vb – This file stores the various states that the game can be in which will be loaded and displayed to the player accordingly.
  • HighScoreController.vb – This file is responsible for displaying as well as collecting the data for the high score.
  • MenuController.vb – This file contains the necessary code that handles the interaction between the player and the menu as well as drawing the menu itself.
  • UtilityFunctions.vb – This file is responsible for handling the interaction between the mouse and the game itself, as well as how the game should draw its view to the player.

In addition to the Visual Basic files, the “Src” directory also stores additional codes within the “Model” folder that contains the more discrete logic that define how the game should behave. The folder structure can be seen as follows:

The files are described as follows:

  • AIHardPlayer.vb – Stores the code that is responsible for the artificial intelligence for the “Hard” difficulty setting. The artificial intelligence for this setting is more intricate compared to others to provide a challenge for experienced players.
  • AIMediumPlayer.vb – Similar to above, it stores the code for the AI for the “Medium” difficulty setting.
  • AIPlayer.vb – Similar to above, it stores the code for the AI for the standard difficulty setting.
  • AIOption.vb – Stores the enumerations for the different types of AI difficulties.
  • AttackResult.vb – Responsible for dictating the results from an attack.
  • BattleShipsGame.vb – Responsible for checking the state of the both players that are in. Conducts a check to see if both players had deployed all their ships. Additionally, the file is responsible for controlling the major portion of the game.
  • Direction.vb – Stores the enumerations for how a ship can be oriented in.
  • ISeaGrid.vb – Defines the read only interface of a grid. Enables the player to see and attack their opponent’s grid.
  • Player.vb – Provides a grid for the player, as well as the grid for the opponent that the player can see. Checks whether all ships are deployed or destroyed.
  • ResultOfAttack.vb – Stores enumerations for how an attack can result in.
  • SeaGrid.vb – Responsible for the grid that the ships are deployed on.
  • SeaGridAdapter.vb – Enables changes for the sea grid view.
  • Ship.vb – Stores the details of the status of the ship itself.
  • ShipName.vb – Stores the enumerations for the different types of ships.
  • Tile.vb – Stores the logic for the tiles within the grid. The tile is able to tell whether if it has been shot before or if it has a ship that’s deployed on it.
  • TileView.vb – Stores the enumerations for the different types of tiles that the tiles can represent.

Aside from the files that have been mentioned, the game also contains the corresponding shell scripts for building, cleaning, and running the game. A README file is added for the convenience of the player that describes what the game requires for it to run (can be read in the "Code" tab in this repository). The original developers for the game are listed in the "contributors.txt".