Problem Class Questions for 1B1a (Programming I)

Week 7 (Starting 24th November)

 

These questions are about designing programs similar to those in the mini-project. For each question determine the set of methods needed to implement a solution, and for each method decide what parameters it might need, what value it might return and, in pseudocode, the method body.

1. Design a program using methods that will take a representation of a grid of dots, say a 10 by 10 2D array of booleans, and decide which letter of the alphabet it represents (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 program that can read a large text file and reformat the contents into pages with 2 or more columns, page headers and page numbers ready for printing.

 

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 algorithms to draw fractal shapes, like these:

Flake Tree

Consider the use of recursive methods (a recursive method calls itself).