CS010 Introduction to Computer Science I
Fall 2007

Project 2.2
A Simulation of Mutation and Natural Selection

This is the second of two project deliverables. In it, you will create a GUI using the gui.ss teachpack.  As before, your project will simulate natural selection for an organism in an environment. An organism that is genetically fit with respect to its environment will tend to flourish and have numerous offspring. Your model will demonstrate the power of mutation and natural selection as a means for guiding search for fit individuals through a space of genetic sequences. 


In this project, you will, among other things:


Use the same data definitions as required for the first project deliverable. However note, represent the "space" in your alphabet as '| | (that is a quote, vertical-bar or pipe, space and closing pipe) so that when you are converting from strings to symbols and back again things will work out as intended.


Design a GUI using the model-view-control framework. The code you wrote for your first deliverable will comprise the model. You will need to write the view components and the callback function(s) that will provide the interaction between your model and view. Be careful keep the model and view distinct; they should only interact with each other through the control.
  1. First, write a function, sim-evolution, to repeatedly evolve the population until an individual in the population perfectly fits the target, or until a maximum number of generations has been simulated. Your sim-evolution functions should consume a number and a genetic-sequence. Hint: sim-evolution probably belongs in your control.
Your GUI should provide the following elements:
  1. a text box where the user can enter their own target genetic-sequence.  Your code should convert the input "alt targ" into (list 'A 'L 'T '| | 'T 'A 'R 'G).
  2. a text box where the user can enter their own maximum number of generations.
  3. a message box directly under the target input box that displays the sequence with the best fit after each generation.  For the example above, if the individual with genetic-sequence (list 'A 'L 'P 'S 'T 'E 'A 'R), then you would display "ALPSTEAR".
  4. a message box that displays the number of generations in this simulation that have taken place.
  5. a button that when pressed initiates the simulation

Submission instructions

Use the standard HW template at the top of your submitted project. Remember that you must acknowledge help that you receive and help that you provide. Follow the recipe and good coding style conventions. Upload your project to the Eureka site by the due date and time.