In the final project for Com Sci 105, you will define a number of small Scheme procedures, similar in scope to those that you write for homework assignments. But, you will also use the procedures that you write, along with some code provided by your instructors, to perform interesting computational experiments that provide insight into the way that cooperative behavior may arise out of selfishness.
The project contains 8 problems, each of which you must solve by defining one or more procedures in Scheme. Hand in problems 1-4 online before midnight on Thursday, 3 December, and bring printed output to class on Friday, 4 December. Hand in problems 5-8 online before midnight on Wednesday, 9 December (the last day of classes). If you finish early, you may bring printed output to the last class. Otherwise, you may hand in printed output in the main Computer Science office, Ryerson 152, before noon on Thursday 10 December. Please print 5-6 and 7-8 on separate pages, so they can be separated and graded simultaneously by different TAs.
Problems 1, 6, and 7 require you to define Scheme procedures implementing strategies for the repeated Prisoner's Dilemma game, described below. Demonstrate your strategies on 2-4 tiny inputs, to show that they behave as required. Then, play your strategies against themselves and a few other interesting strategies. In problem 1, use the 2-player play-loop procedure provided on Johnny Three. In problems 6 and 7, use the 3-player procedure play3-loop that you define in problem 5.
Problems 2-4 and 8 require you to define Scheme procedures that take old strategies and numerical parameters as inputs, and create new strategies. In all cases, you need to use lambda expressions to describe the outputs of these strategy-transforming procedures, since the outputs are also procedures. Testing a strategy transformer is a bit more complicated than testing a strategy. You must choose a small number of different inputs to your strategy transformer, then test each of the resulting strategies. Then, play 2 or 3 of the strategies produced by your strategy transformer against other strategies.
Problem 5 requires you to modify the 2-player game supervision code provided by the instructors so that it works for 3 players. Hand in the Scheme code for each of the procedures that you modify. The game supervision code will be tested in problems 6-8. Be very careful, though. An error in problem 5 will ruin your work on problems 6-8.
For 10 points extra credit, you may submit a strategy to participate in a tournament described in the last section. hand in your entry online on Johnny Three. Do not submit printed copy. You will get credit for participation no matter how well or poorly your strategy fares, but your procedure must include the required comments and it must not be disqualified by generating an error. The deadline for tournament entries is midnight on Monday, 7 December.