UCL Logo

Problem Class Questions 2006
for COMP1008 (Object-Oriented Programming)

Week 2 (Starting 23rd January)

These questions are about designing small programs using classes and methods. For each question determine the classes needed and the set of instance variables and methods each class requires. For each method decide what parameters it might need, what value it might return and write, in pseudocode, the method body.

1. Design a program that will take a representation of a pattern of dots, say a 20 by 20 grid, and decide which letter of the alphabet is represented by the pattern of dots (i.e., do pattern recognition). The pattern might have some distortion, interference and ambiguity, and the program should be able to deal with this

2. Design a progam to control a set of lifts such as those in the new building (when they are working!). Consider how the movement of the lifts can be optimised to deal with requests as efficiently as possible. (Lift control is a classic design/algorithm problem - do some research to find out more.)

3. Design a program to play noughts and crosses (tic tac toe) against a human player. Pay particular attention as to how the program can determine what move to make next in order to win.

4. Design a program to play simple chess end-games against a human. How can the chess board and pieces be represented? How can the program determine what move to make next?

5. Design a program to draw fractal shapes, like those below, according to a set of parameters that the user can specify to control the size and shape:

Flake Tree

First work out by hand how these kinds of shape can be drawn as a series of lines. In your program design, consider the use of recursive methods (a recursive method calls itself).

 

Remember, for all these questions you should be thinking in terms of classes, methods and objects.

Last updated: September 2, 2006

Computer Science Department - University College London - Gower Street - London - WC1E 6BT - Telephone: +44 (0)20 7679 7214 - Copyright 1999-2006 UCL


 Search by Google