-
>
>
>
>
Programming Assignments >
Assignment 6 - Checkers
Objectives
- to create a framework using templates and inheritance
Assignment
Refactor the given implementation of American Checkers (English Draughts)
so it is extensible for other interfaces and other games.
You must submit a makefile that creates an executable called
Checkers
that behaves like the executable built
from the given code.
You must refactor the given code using templates and/or inheritance
so that
- it is easy to change the interface (input and output); and
- it is easy to modify the program to play different turn-based
games played on a checkerboard or similar grid-based playing
board.
Ideally, after refactoring, the changes necessary for different interfaces and
different games
will be adding minimal new code in new classes
with no modifications to the code you
submit for Checkers
except for the main
function. You will make such changes and additions for the next
assignment and that assignment will be graded in part on the extent
of your changes and additions to the code you submit for this assignment.
We also reserve the right to deduct points from submissions for
violations of the following guidelines.
- Submissions should not rely on any particular compiler's
implementation in situations where the C++ specification
states that behavior is undefined.
- Submissions should not leak memory.
- All source code should be easily comprehended, with adequate
and consistent spacing, concise but descriptive idenitifiers,
comments before long sequences of code, and enumerations and
constants favored over literals.
- Submissions should be modularized, with collections of related
functions and methods divided into separate files. Generally this
means that each class that is intended for external use should
have its own header and implementation files declaring and
defining its members and related functions.
- Header files should be written so that they can
be
#include
d regardless of what other files have
been #include
d -- if a declaration is required by
your header files, then #include
the appropriate
header file in your header file (or write a forward declaration in
your header) rather than relying on your #include
rs
to have already #include
d those header files before
they #include
yours.
- You should use C++ libraries and constructs rather than the
corresponding C libraries and constructs where possible and not
otherwise specified (for example, use
cin
and cout
with the I/O operators <<
and >>
rather than printf
and scanf
).
- Each public member of a class should be documented with a
comment before it in the header file. For a method the comment
should include 1) a description of the parameters including any
limitations on the values allowed (preconditions), and 2) a
description of what the function does and/or what it returns
(postconditions).
- Things that make sense to be declared as
const
should be declared as const
.
- There should be no warnings when your code is compiled with
the
-Wall
and -pedantic
options.
Files and Submissions
Submit everything you need in order to build Checkers
.