By the end of this course you will complete and hand in a programming
project, worth 15% of your grade. Start early. Hand in during the finals week.
You have considerable freedom in the choice of your project. I have to
approve your choice, though. Alternatively, you can pick one of my suggested
projects from the list below.
You can use either the Metrowerks CodeWarrior (Mac lab), Visual C++ 5,
or a UNIX compiler (gcc, g++, probably in conjunction with Tcl/Tk library if
you want to do graphics). The point is that I must be able to run
your program to grade it.
The possible projects are as follows:
Mathematical projects (little or no graphics)
- Write a class BigInteger for handling integers of arbitrary
size (with built-in int you cannot have more than 4 billion).
You will need to allocate memory dynamically and create/copy/destroy
your objects correctly. Overloading arithmetic operator would
be nice. Test: compute 100! = 1*2*3*...*99*100 .
- The same for floating point numbers of arbitrary precision.
Again, you will have to allocate memory dynamically. Test:
compute the first 100 decimal digits of Pi. The value of Pi
can be found by summing various infinite series (the more
terms you take, the better the resulting approximation of Pi)
One of the simplest known series for Pi is
1 - 1/3 + 1/5 -1/7 + 1/9 - ... = Pi/4
Unfortunately, this particular series converges very slowly.
There are much faster converging series, one of which I'll give
you if you choose this project.
Games (graphics and simple logic)
Here I want you to implement the graphics interface
for a game. For a board game, you classes should
Your code should be written with the view towards the possibility that
another programmer will write a logic module for your
game, and integrate it with your graphics front-end.
- store the position on the board,
- draw and re-draw the board,
- offer public methods through which another
programmer will communicate a proposed move,
- check every move for correctness (i.e. compliance with the
rules of your game),
- detect whether the game comes to an end with that move (a player
wins, or no more moves are possible).
So far I could think of: