1. Setting up the game:
a. Download all the files in the following folder and load into the same folder for MATLAB:
b. Once all files are saved to the same folder, open Main.m and click the “run program” button to start gameplay.
2. How to play:
Ex)
{ The game opens to a start menu, which displays 4 options, which can be selected with the number keys 1-4:
- Instructions – shows instructions on how to play the game in the command window.
- Start Game – starts the game.
- Difficulty – also starts the game.
- Exit – exits the game.
Once the game has started, players must first select a ship from the menu on the left, and place it somewhere in the bottom board. Ships cannot overlap or exist outside the bounds of the board. Players must then select a difficulty by clicking the buttons in the menu with stars, with the levels being described below:
5 stars: AI places its ships randomly and makes guesses based on its smart AI
4 stars: AI places its ships randomly, but makes random guesses
3 stars: AI places its ships in a set position, and makes random guesses.
After difficulty selection, players must press the “Play” button between the two boards to start their turn. Between the player pressing play and making their first move, the AI generates its board based on the difficulty selected. When the player selects a square on the top board, the game checks if the AI has a ship there. If it does, the square is marked with a hit. If not, it is marked with a miss. The AI then takes their turn, selecting a square and having the game check if the player has a ship there. These turns then replace back and forth until the AI or player has sank all the other’s ships. At that point, the game says if the player lost or won in the command window, and asks if the player would like to play again. If yes, the player must enter ‘y’ and press enter. The game will then restart at the start menu. If not, the player must enter ‘n’ and press enter. The game will then exit.
To learn about the game and how to play it, the player can simply read and follow the instructions given in the command window when they press 1 for instructions on the start menu.
3. Playing/Taking turns:
To place ships, the player must first select them from the menu on the left, and then select a square on the bottom board, using left click to place the ship horizontally, or right click to place the ship vertically.
The player will always place the left-most or top-most part of the ship.
To select difficulty, the play must select one of the buttons in the menu on the left with stars on it. The button with 5 stars selects a 5 star difficulty, 4 stars selects 4 star difficulty, and 3 follows the same pattern.
To start the actual game, players must click on the “Play button” located between the two boards.
All selections the player makes while in game must be in the top board.
To make a move, all the player needs to do is select a square in the top board.
To play the game again/stop the game, the player must navigate to the command window after winning/losing and enter ‘y’ to play again, or ‘n’ to exit the game.