Homework 2 - Chess Classes

Introduction

In this assignment you will practice

Problem Description

Your mean professor gave you a super hard homework and you need a break. In a future homework assgignment you’ll re-write the PGN reader you wrote in HW1 but for now you’ll write a few simple classes and an enum that you may find useful when you re-write your PGN reader.

Solution Description

Write the following classes and enums:

For each class include Javadoc comments as described in the CS 1331 style guide.

We will test your classes by simply using them, for example:

Piece knight = new Knight(Color.BLACK);
assert knight.algebraicName().equals("N");
assert knight.fenName().equals("n");
Square[] attackedSquares = knight.movesFrom(new Square("f6"));
// test that attackedSquares contains e8, g8, etc.
Square a1 = new Square("a1");
Square otherA1 = new Square('a', '1');
Square h8 = new Square("h8");
assert a1.equals(otherA1);
assert !a1.equals(h8);

Grading

There are many bonus points available in this assignment.

Checkstyle deduction will be capped at 20 points for this homework.

Tips

Turn-in Procedure

Submit each of your Java source files (all nine of them!) on T-Square as separate attachments. When you’re ready, double-check that you have submitted and not just saved a draft.

Verify the Success of Your Submission to T-Square

Practice safe submission! Verify that your HW files were truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.