CS 242 Spring 2012 : Assignment 1.1

This page last changed on Jan 30, 2012 by cemeyer2.

Assignment 1.1 – Extending Your Puzzle Solving Application

For this assignment you will:

  1. Clean up any problems in your code for Assignment 1.0, and fix any algorithmic and design shortcomings.
  2. Generalize the puzzles you can solve.
  3. Create your own puzzle to solve.

Assigned Reading

Submission

This assignment is due Thursday, February 9th, 2012 at 8AM CST. Please be sure to submit in SVN, and ask your moderator or TA before the deadline if you have any questions. Also, make sure to place your work in a folder called Assignment1.1. Please match this spelling exactly to not loose points.

Part I: Refactoring

Read here and here for further discussion about this topic.

You spent Assignment 1.0 making it work, now you will:

  • Refactor your code to make it right.
  • Extend your application to solve more puzzles.

You should refactor your code to eliminate any code smells (e.g. use communicative naming, decompose larger methods into smaller separate methods, etc), add missing tests, or other problems discussed in section. You should also address any design issues that were brought up by your section leader or other students in discussion. Check the online grade book to see if any comments were left for Assignment 1.0.

Part II: New Puzzles

Your task for this part of the assignment is to add 2 new puzzles to your application. You must choose one puzzle from each of the following two groups:

Group 1:

  • 14 bishops – given an 8 x 8 chess board, how can 14 bishops be placed such that no two can capture each other
  • 16 kings – given an 8 x 8 chess board, how can 16 kings be placed such that no two can capture each other
  • 8 rooks – given an 8 x 8 chess board, how can 8 rooks be placed such that no two can capture each other

Group 2:

  • Domination – given a number n, what is the minimum number of queens needed such that every square on an n x n chess board can be attacked by a queen
  • Queens and Knights – given a number n, what is the largest number m such that m queens and m knights can be placed on an n x n chess board where no two pieces can attack each other

Before you start implementing, write tests for your new puzzles first, commit then to SVN, then implement the puzzles as needed. You may need to create new concrete Piece classes as well as new solver classes. You will also need to modify your user interface to deal with the changes. You should output using the same basic output code that you used last week. You might need to do some refactoring to accomplish this, but in any event do not copy/paste/modify. Any time in this course you see yourself using copy/paste, think how could I do this by reusing existing code?

Part III: Another New Puzzle

For this part of the assignment, we are asking you to get a little creative.

Your first task is to create a new custom chess piece. You can name it whatever you would like and you need to determine how it moves on the board. For instance, you can have a piece that moves diagonal 3 spaces, then horizontal or vertical 1 space. You could also have a piece that moves like a king, but “jumps” 3 spots before landing. It is completely up to you how your piece should work. The only stipulation is that it cannot move like any traditional chess piece does.

Once you have created your custom piece (testing it before implementing it of course), you need to determine how many of your custom piece (call that number m) can be placed on a n x n chess board such that no two can attack each other. Your program should prompt for n, then output the maximal m along with the configuration(s).

Before you start implementing, write tests for your new puzzle and piece first, commit then to SVN, then implement the puzzle as needed. You may need to create new concrete Piece classes as well as new solver classes. You will also need to modify your user interface to deal with the changes. You should output using the same basic output code that you used last week. You might need to do some refactoring to accomplish this, but in any event do not copy/paste/modify. Any time in this course you see yourself using copy/paste, think how could I do this by reusing existing code?

Rubric

Category Weight Notes
Basic Preparation 3 Ready to go at the start of section
Cleverness 3 The hardest points on the rubric
Code Submission 6 Submitted on time and to the correct location in the repository
Decomposition 9  
Documentation 6 Javadoc comments for each class and each function listing a brief summary, its parameters, and its return value
Effort 3  
Naming 3  
Overall Design 9  
Participation 6  
Presentation 3  
Requirements Satisfaction 3 Refactoring
Requirements Satisfaction 12 2 new puzzles
Requirements Satisfaction 9 New custom puzzle
Testing 21 Unit tests for all public functions, acceptable (>75%) coverage
Document generated by Confluence on Mar 29, 2012 02:55

  1. No comments yet.

  1. No trackbacks yet.