Managing Software Development
Project 7: Generalize the Remaining Agents from SAT to CSP / Design by Contract / 
Requirements and Testing / Reverse Engineering

Spring 2008
Karl Lieberherr  
Out: March 4, 2008

Due date: March 17, 2008 

Grading of your algorithmic player/administrator:

50% -- Code compiles and runs. Runs correctly with 2 players plus administrator, 
       one your player and the other a "simple" player. A simple player 
       is one that uses only a restricted set of derivative types.
25% -- Code runs against several complex players and wins, i.e. it wins the competition.
       The players are sorted based on the money accumulated at the end of the game.
       The first gets 25%, the second 12.5%, the third 6.25% etc.
       If two or more players achieve a tie, they get the lowest score if
       there would not have been a tie.
25% -- General code quality/clarity.

PART 3 IS NOT COMPLETE BUT PLEASE START WITH 1 and 2.

This subproject completes the generalization of the SDG game
from MAX-SAT to MAX-CSP.

PART 1.
===========================================================
Generalize the Raw Material Construction Agent.
See
http://www.ccs.neu.edu/home/lieber/courses/csu670/f07/project/project5/project5.html
for the corresponding MAX-SAT version.

Generalize the Derivative Creation Agent and the Derivative Buying Agent.
See
http://www.ccs.neu.edu/home/lieber/courses/csu670/f07/project/project6/project6.html
for the corresponding MAX-SAT version

You may choose your own algorithms. Your main objective should
be to beat the other players and not following my suggestions.

You should have now a complete player for SDG(CSP) 
along with an administrator.


PART 2:
===========================================================

Run your player against itself, produce a history of transactions
and use your checker from the previous project
to check the history.

PART 3:
This part is prepared based on a program written by Bryan Chadwick
==================================================================

John, an employee at your company, has written the enclosed code
(file BST.pdf) and then he left the company. 

Connection to Reverse Engineering:
Reverse engineering often is done because the documentation 
of a particular device has been lost (or was never written), 
and the person who built the thing is no longer working at the company.

Your task is to understand this code, properly document it,
extend it, write proper requirements for it and develop test cases.

PART  A
=======
In which sense can this code be viewed as a wizard?

Apply Tip 50:
Don't Use Wizard Code You Don't Understand

Write requirements and test cases for this code.
What does code mean here? You should consider self-contained
reusable pieces of the code.


PART B
======
Read section 21: Design by contract.

Write the contract for the insert method.
Is there an interesting class invariant?
Write code that checks at run-time whether the contract is satisfied.


PART C
======

Write a program that increments not by 1 but by a constant c
that can be changed when the increment program is called.
I.e., the constant is a parameter to the increment program.
In other words, write a program that increments each node
in a tree by c.


PART D
======

Write a program that computes the depth of a tree and the number of nodes
in a tree.


PART E
======

OPTIONAL; easy if you know Latex: Also generate the code to print pictures in the 
BST.pdf file.