Code Files' Description - Panvina/BattleShips---Six GitHub Wiki

VB.Net Code Files in src/

1. DeploymentController.vb

  • Controls the player's actions during the deployment phase
  • Handles user input during the Deployment phase of the game, including:
    • selecting and deploying ships
    • changing direction of the ships which are about to be added
    • deploying ships randomly
    • ending deployment phase (start the game)

Most of the code are clearly documented

2. DiscoveryController.vb

  • Handles the battle phase
    • handles input during the discovery phase of the game, from mouse clicked to key pressed
    • draw the game, including messages responding to user's attack, during attack phase

everything is concisely documented

3. EndingGameController.vb

  • Manages the interaction at the end of a game
    • draws the end game screen (win/lose)
    • handles the inputs during the end of the game
    • reads the high scores data from highsSwinGame text file, regardless of user interaction

All the code are clearly documented

4. GameController.vb

  • Controls the game, manages user input, displays the current state of the game
    • redraws the screen based on the current state of the game and based on user input
    • plays sounds corresponding to user input
    • displays messages responding to user input
  • creates the game based on selected AI settings (difficulty level)
  • reads key and mouse input and converts these into actions for the game to perform, actions performed depend on the state of the game

All the code are well documented

5. GameLogic.vb

Actually a GameMain file which opens a graphics window, loads resources, etc.

All the code are documented, but lack of explanation of what the file does

6. GameResources.vb

  • Stores, loads, and plays/displays all game media resources (images, audio, etc.)
  • siren.wav is missing

Lack of explanation for LoadResources(), ShowLoadingScreen(), PlaySwinGameIntro(), ShowMessage(), EndLoadingScreen()

7. GameState.vb

  • Lists all the state of the game, describes what the player does as well as what to display onscreen at each state
    • Viewing main menu
    • viewing game menu
    • viewing high scores
    • altering settings
    • deploying
    • discovering
    • ending
    • quitting

All states are listed and and described

8. HighScoreController.vb

  • Collects and displays high score data (from Resources/highscores.txt)
    • sorts the scores
    • saves the new record back to the text file
    • draws the high scores on screen
    • handles user input: reads in user's name for their score

All the code are well documented 9. MenuController.vb

  • Handles the drawing and processing of user interactions from menus in game
  • There are 3 menus: main menu, game menu, and settings menu. Each has its own options.

All the code are explained clearly

10. UtilityFunctions

  • utility methods for drawing and interating with the Mouse

Lack of explanation for adding animation functions


VB.Net Code files in src/Model

1. AIHardPlayer.vb

  • Defines difficulty level - Hard level
    • AI Player knows directions of ships when 2 ship tiles have been revealed, and the player will try to destroy that ship

All the code are well explained. The AI's ability is decribed in detail.

2. AIMediumPlayer.vb

  • Defines difficulty level - Medium level All the code are clearly explained.

3. AIPlayer.vb

  • abstract class of other AIPlayer class

All the code are clearly documented

4. AIOption.vb

  • A list of available difficulty levels of the game. Brief description of each level is also included

5. AttackResult.vb

  • Gives result after a shot has been made, including:
    • displays textual description of the result
    • sets the value (hit, missed, destroyed) toPpossibleAttack

All the code are clearly documented

6. BattleShipsGame.vb

*Controls most of the game:

  • Adds 2 players into the game while making sure their ships are all deployed
  • Allows players to shoot and swap turn between players
  • Check if players are destroyed

All the code are clearly documented

7. Direction.vb

  • A list of all possible directions that a ship can be oriented:
    • Left/Right
    • Up/Down

8. ISeaGrid.vb

  • Defines the read-only grid where players attack their opponent's ships

All the code are clearly documented

9. Player.vb

  • Handles the player's gameplay (displaying and updating player's ISeaGrid)
    • sets and displays the enemy's grid from the player's side
    • displays the number of shots the player has made, including missed shots
    • allows player to shoot at a given row/column

all the code are clearly documented.

10. ResultOfAttack.vb

  • A list of all possible results of an attack, including:
    • Hit
    • Miss
    • Destroyed
    • ShotAlready
    • GameOver

11. SeaGrid.vb

  • The grid on which the ships are deployed
    • Only viewable via the ISeaGrid interface as a read-only grid
    • Can be used in conjunction with SeaGridAdapter to mask the position of the ships
  • Returns and displays a result when a tile has been hit

All the code are clearly documented

12. SeaGridAdapter.vb

  • Redraws (changes) the sea grid view as the game processes
  • Mask the position of the ships: change the tiles on discovery grid into sea tiles instead of ship tiles All the code are clearly documented

13. Ship.vb

  • A class of a ship object, defining its name, size, no. hits taken, its status (e.g. detroyed, deployed, etc.), etc.
  • the ships change its status as the game processes

All the code are clearly documented

14. ShipName.vb

  • A list of all available ships in the game.
    • Tug
    • Submarine
    • Destroyer
    • Battleship
    • AircraftCarrier

15. Tile.vb

  • A class of a tile, defining a tile's characteristics and behaviours:

16. TileView.vb

  • A list of all visable values for a given tile:
    • Sea
    • Miss
    • Hit
    • Ship

All the code are clearly explained