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

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:

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.

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:

Check bug names and target your tests to expose them:

9) Style and Submission Checklist

Before submitting:

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.