B. User Manual

Battleship

Battleship is a two player game where opponents try to sink each other’s ships. Each player gets a targeting board and a placement board. placing their ships on the placement board. Both players take turns firing rounds at each other, using a coordinate system of the Alphabet and Numbers on the targeting board.

Each Player Gets the Following Ships:

  • Battleship (4 Spaces)
  • Destroyer (3 Spaces)
  • Aircraft Carrier (5 Spaces)
  • Patrol Boat (2 Spaces)
  • Submarine (3 Spaces)

 

The user places their ships on a grid system designated by the program. The program will allocate the appropriate number of spaces for each ship and record their location on a grid. Once the player finishes placing their ships, the AI will place its ships and the game will begin. Then, the player is asked to select a coordinate using an Alphabet, number system ranging from 1 to 10. (Ex. A1, B7, I10). The AI will tell the user if their selected coordinate is a hit or miss, and the shot is marked white if it misses, or red if it hits on the targeting board. The AI will take its turn and select a coordinate to fire a shot. The program will tell the user if their ship is hit and display the shot on the placement board. Once the player or the AI has hit enough shots to sink a ship, the ship will painted black on either the player’s targeting board or the player’s ship grid to simulate that it has been sunk. The program continues on until all of the player’s or AI’s ships have been sunk.

21 Sticks

21 Sticks is a game where the player faces against the AI in a counting game in turns. Whoever, reaches the sum of 21 first loses, and both the player and AI can only place one or two sticks in one turn.

The program is composed of main parts. The first part prompts the player to only place 1 or 2 sticks. The sum, which starts at 0, is added to whatever amount of sticks the user chooses to place down. Then, the turn counter, which starts at 1, will increase by 1, signifying that the player has made their turn. After it switches to the AI, which will place either 1 or 2 sticks randomly. Similarly, the number of sticks the AI places will be added to the sum, and the AI’s turn counter will increase by 1. This continues until the sum reaches 21. Afterward, the program will examine the turn counter. If the turn counter falls on an odd number, the player loses, and if it falls on an even number, the AI loses.

 

Dice Games

The Dice Game is a luck game which the player rolls five dices in a row. The player wins if the sum of the five dice rolls is over 18, and loses visa versa.

The program is composed of three main parts. The first part generates and displays a random number between 1 and 6, simulating rolling a dice when the user presses Enter, doing this 5 times to simulate 5 dice rolls. The second part adds up all the numbers generated by the program. The third part compares if the sum of the all the numbers generated is greater or less than the value 18, displaying a win or loss.