How mcgarity99/terminal_battleship works
Terminal_Battleship is a single-file C++ command-line Battleship game: the player plays against a basic computer opponent, with randomly placed ships and ASCII board output. The main function initializes the boards, sets up fleets and mines, then runs gameplay; presentation and computer targeting are separate responsibilities within the same source file. The excerpts show initialization and ship placement, but omit much of the turn loop, so gameplay-to-firing and AI dispatch links are not asserted.
Main entry points: BattleshipGame.cpp Game controller
Components 9
Game setup
- Board initialization
BattleshipGame.cpp - Fleet placement
BattleshipGame.cpp - Mine placement
BattleshipGame.cpp
Battle and AI
- Game controller
BattleshipGame.cpp - Player firing
BattleshipGame.cpp - Computer opponent
BattleshipGame.cpp
Terminal display
- Board display
BattleshipGame.cpp
Other components
- Player
- Command-line terminal
Connections 10
- Player → Game controller: plays through
README.md - Game controller → Board initialization: initializes
BattleshipGame.cpp - Game controller → Fleet placement: places ships
BattleshipGame.cpp - Game controller → Mine placement: places mines
BattleshipGame.cpp - Game controller → Player firing: runs turns
BattleshipGame.cpp - Game controller → Computer opponent: uses opponent
BattleshipGame.cpp - Game controller → Board display: displays boards
BattleshipGame.cpp - Board display → Command-line terminal: prints ASCII
README.md - Player → Player firing: fires at fleet
- Computer opponent → Player firing: fires at player
BattleshipGame.cpp