CMPT 102 Assignment #5

This assignment is worth twice as much as the other assignments. Accordingly, you will probably have to spend more time on it.

In addition to solving one of the problems outlined below, there will be marks available for the quality of your solution. This will include style and efficiency.

The Choices

You have two choices of problems for this assignment. The two problems have roughly equal difficulty, so your choice of problems should be based on subject of interest, not which one is easier.

The real details of the assignment are in the Acrobat or Postscript files linked below.

Simulating Billiards

The first option is to simulate the movement of balls on a pool table. The problem has been simplified somewhat to make it easier to work with.

Details of this option: [ Pool PDF | Pool PS ]
Sample output animation: [ Pool GIF (250K) ]

Simulating Populations

The second option is to use a common mathematical model of population change to simulate populations of two species in an area. The species are a predator and prey, so their populations depend on each other.

Details of this option: [ Pop. PDF | Pop. PS ]
Sample output animation: [ Pop. GIF (110K) ]


For this assignment, you will have to use both structures and arrays. If you're not comfortable with these yet, you might want to try some smaller problems first, before you dive into assignment 5.

You can try the warmup problems. These are worth no marks and you shouldn't hand them in. But, if you're struggling with arrays or structures, the first piece of advice you will get from the instructor or TAs will be "do the warmup problems".

This is hard. Will I finish?

Yes, it is and maybe not. If you don't finish this assignment, that's okay. Not everybody will.

First, here are some tips to help you actually get this program working:

If you don't think you can finish, you can still get most of the marks without a complete solution. Here are some things in particular that will get you a lot of marks:

If you want, you can also include a file called about.txt in your submission that contains a paragraph or two explaining what you have done and what you haven't. Remember, the more you can convince us you understand what's going on, the more marks you'll get. In fact, it's entirely possible that a unfinished program will get more marks than a finished one, if the person demonstrates that they understood what was going on, but just couldn't finish.

Optional stuff

There are some optional extensions to the image drawing functions that you can use.

Administrative Stuff

As with other assignments, the late penalty will be 10% per day. In addition, for this assignment, please note that no assignments will be accepted after April 5th.

Being able to complete a program like this is central to getting the CMPT 102 credit. Thus, any academic dishonesty on this assignment will result in a recommendation that you receive an F in the course.

Copyright © Greg Baker, last modified 2003-06-26.