Joshua Philip Ingalls

Logo

CSCI 496: Senior Portfolio
In partial fulfillment of the requirements for the degree of Bachelor of Science in Cybersecurity (Class of 2025)

View My Resume

View My LinkedIn Profile

View the Project on GitHub ThunderboltG/JoshuaIngalls.github.io

Back to Portfolio

Battleship

Project description

Battleship was the final project of CSCI 235.

Computer code was provided by the instructure, Dr. Hayes.

How to compile and run the program

How to compile and run the project.

g++ -Wextra -std=c++17 -o battleship Battleship.cpp
./battleship

UI Design

The game is run through the CLI. The first screen is the ship randomizer. This allows the user to randomize the position of their ships before the game begins (See Fig 1). Once the user confirms their ship placement, the game begins with the user getting the first move (see Fig 2). The user and the computer will take turns shooting at different positions on the board. After each round of action, the board will display the results of both the user and the computer’s turns, display the current board state, and prompt the user for their next move (see Fig 3). The game checks the validity of each move, notifiyng the user of either an invalid move or an already made move (see Fig 4 and Fig 5). Whenever the computer or the user sinks a ship, a notification appears telling what ship has been sunk (see Fig 6). Once either the computer or the user sinks all enemy ships, the board will go to the results screen. This screen reveals the ships of both boards, and states the winner of the game (see Fig 7). The program then exits, allowing the user to rerun the start command to play another game.

screenshot
Fig 1. The launch screen and ship select menu

screenshot
Fig 2. The starting board of the game

screenshot
Fig 3. Feedback when an invalid move occurs

screenshot
Fig 4. Feedback when an invalid move occurs

screenshot
Fig 5. Feedback when an already shot area occurs

screenshot
Fig 6. Feedback when a ship is sunk

screenshot
Fig 7. Game finished screen

3. Additional Considerations

While the program is currently not suited for a two-player match, a small change to main could allow for two players to face each other. The board would most likely be invisible to both players while the game is ongoing.

For more details see Battleship.

Back to Portfolio