p4-battleship
EECS 183 Project 4: Battleship - Student Quickstart
Full specification (all details + sample runs): Full Spec
This page is a shorter, student-first version of the full spec. It is meant to help you get started quickly, but you will still need the full spec to complete the project.
0) Logistics
- Due: Friday, March 20, 2026 at 11:59 p.m.
- Autograder: Direct autograder link
- Grading: 70 points correctness/testing, 10 points style
- Submissions: 4 per day with feedback + 1 one-time bonus submit
For full grading and submission details, see Grading and How to submit.
1) Big Picture
You will build a one-player Battleship game in C++ with classes.
You will implement:
- In this order:
Position.cpp,Ship.cpp,Player.cpp,Game.cpp - Along with
test.cppwhile completing the files above - Editing
grid1.txtandgrid2.txtto test file I/O forPosition.cppandGame.cpp
Reference: Classes Reference: Suggested Timeline
2) Starter Files
Download starter files: starter-files.zip
You need to create a project with all of the starter files. See the Project Setup below before creating a project. Do not rename files and do not change required function declarations.
Reference: Starter Files
3) Project Setup (Required)
This project uses file input (grid1.txt, grid2.txt), so setup matters.
If your IDE project is not configured correctly, file reading will fail even if
your code is correct.
Read and follow: Project Setup
Xcode
This project (and Lab 7) require additional steps to complete the creation of your project. Note: you must complete all of the steps, including editing the scheme, here:
Reference: Xcode setup instructions
Xcode setup video:
Visual Studio
Follow the course’s Getting Started with Visual Studio setup instructions (the same project-setup process used earlier in the term, now with more starter files).
If setup is not done correctly, the project cannot work correctly. This applies to this project and Lab 7.
Reference: Visual Studio setup instructions
Visual Studio setup video:
4) Lab 7 Connection (Important)
Position.cpp in this project is the same assignment content as Lab 7.
- You can and should use the same
Position.cppsolution for both. - You can and should use the same
Position-related test cases for both. - You can and should share your
Position.cppand related tests that you create with your peers in the lab.
5) Use the Function Table Early and Often
Before you start each function, check the Function Table.
Then check it again while implementing to confirm which helper functions you should call. This helps you avoid duplicated logic and autograder mistakes.
6) Class-by-Class Focus
Position
Implement and test all required behavior first, since later classes depend on it.
Reference: Position
Ship
Focus on ship placement, hit tracking, and sunk-state behavior.
Reference: Ship
Player
Focus on grid state, adding ships, attacking, and file loading.
Reference: Player
Pay special attention to: The load_grid_file() function
Game
Focus on turn flow, validating moves, updating boards, printing output, and end conditions.
References:
7) Output Formatting Matters
For this project, your visible output should match the required text and punctuation shown in the spec and sample runs.
Use these to verify behavior:
8) Testing Expectations
Your test.cpp should do more than only simple “works in one normal case”
tests.
Include tests such as:
- normal cases - what you think of first when reading the RME.
- boundary cases (e.g., first/last row/column)
- invalid or rejected inputs where appropriate (do not violate the Requires of the RME)
- repeated actions that can reveal state-update bugs (e.g., hit a Ship until it should sink)
Check bug names and target your tests to expose them:
9) Style and Submission Checklist
Before submitting:
- Follow the EECS 183 style guide
- Check the Project 4 Style Rubric
- Ensure required header comments are complete
- Ensure your files compile with the starter setup
- Compare your use against Sample Runs
Submission details:
10) Optional S’more
If you finish early, you can try the optional medium-difficulty AI extension:
There is no autograder for S’more.