Josh Rubini's U of I Website


CS-120: Computer Science I

Text: C++ For Everyone, Horstmann, ISBN 0-470-38329-1, Copyright 09, Publisher: Wiley

Computer science I deals with introductory concepts in computer programming. Topics we cover in this class include:

  • C/C++ syntax including variables, I/O, expressions, branching, and iteration
  • Data aggregation: arrays and structs
  • Indirection using pointers and dynamic memory usage
  • Objects and classes
  • Abstract Data Type: Lists

Topics by week:

Additional resources

The Ladybug Game

The Ladybug Game is an educational tool originally developed by Dr. Terry Soule as an easy to use way of watching evolution "in action" and as a possible platform for an evolutionary game. The project received further attention and funding from the Beacon Center, and I was hired on to transform it into a useful, engaging educational program. With the help of Melissa Kjelvik (MSU), we hope to disseminate this program to K-6 classrooms in order to give younger students a better understanding of how evolution works.

The application is broken into 5 lessons, each designed to help strengthen a student's understanding of evolutionary processes. There are several pictographcal representations of particular information shown below the "leaves" where the ladybugs and aphids are. For each lesson, you can see the current background color, the average color composition of the aphid population on that background, and the evolutionary parameters that are currently active. You can also see what the average chance the ladybug has to "see" an aphid in the population (the lower this number is, the less likely an aphid is to get eaten). Additionally, there is a color-wheel below the leaves which you can use to change the base background color. A short description of the lessons is below.

  • Lesson 1: Introduction -- In the first lesson, students get to control the ladybug, moving it around the screen to eat aphids. This is the only "lesson" where the students do this; in all other modes the ladybug is automatically controlled by the computer. One fun thing to do would be to try and eat all of the aphids of a particular color.
  • Lesson 2: Evolution in Action! -- This option is really more of a "see it working" sort of thing. The screen is split into two sides, each with its own ladybug and aphid populations. The background of each side is different, and the initial aphids have random coloration. In a few seconds, the ladybug will eat hundreds of aphids, causing new aphids to be "born" inheriting the attributes of one of the remaining aphids on the screen, with small mutations applied to color, speed, strategy, etc. You can see which aphid is currently being targeted by the ladybug by a small "halo" around it (black against light-colored backgrounds, and white against dark or single-color backgrounds). I would encourage students to try changing the background color to something different once the aphids start to "blend-in" to the background leaves, and watch as the population adapts to the new color! A good thing to watch for is when the "halo" seems to blink around the screen rapidly, meaning the ladybug is now having a very difficult time maintaining a target to eat.
  • Lesson 3: Variation -- In the next few lessons, a piece of the "evolutionary machinery" is removed, making it difficult (or nearly impossible) for the aphids to evolve and adapt to their environment. In lesson 3, we remove the small variations in speed, color, and strategy when an aphid is born in the left-hand population; each new aphid is now an exact replica of its parent. Students will see the left-hand population quickly converge to many copies of a single individual, usually one of the better adapted individuals in the original population. However, if they once again change the background colors of the right and left-hand screens, they will see that while the right-hand population will once again eventually adapt to the new color, the left-hand population is "stuck" with its original color, since there is no way to introduce new colors into the population!
  • Lesson 4: Inheritance -- In this lesson, similar to lesson 3, we remove another of the building blocks of evolution: inherited traits. Aphids in the left-hand population are born ith completely random coloration, speed, and strategy, instead of inheriting these traits from their parents. Interestingly, the population average will drift slightly toward the goal color, because randomly generated individuals whose color matches closely with the background will still be harder to eat, but it will never converge like the right-hand population will.
  • Lesson 5: Selection -- In the final lesson, the ladybug has near-perfect vision, removing the aphids' ability to "hide". It will always target and eat the closest aphid within its view, which effectively removes the selective pressure for color! What is interesting about this lesson is that the aphids can still evolve good evasion strategies, and a fun exercise for students might be to figure out what sort of traits are now the ones being selected. Generally, what you will see here are the aphids on the left evolve to hug the corners, since moving from one side of the screen to the other usually breaks the ladybug's target.

Particular attention was paid to making this program easy to understand and interact with. While in the main it is a teaching tool, we also hope that it is simply fun to watch the ladybug zoom around the screen, watch the aphids adapt, and when they start to get too good at hiding, change the background! With this in mind, we welcome any suggestions you might have to improve the user experience.