CS010 Introduction to Computer Science I
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
In this project, you will, among other things:
practice using abstract functions
gain experience in modeling real-world problem domains
encounter a new form of recursion (part 2)
build a GUI by which one can interact with your program (part 2)
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.
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:
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).
a text box where the user can enter their own maximum number of generations.
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".
a message box that displays the number of generations in this simulation that have taken place.
a button that when pressed initiates the simulation
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.