CSC111 Homework 11

From dftwiki3
Revision as of 17:11, 15 April 2010 by Thiebaut (talk | contribs) (Something fun and unrelated)
Jump to: navigation, search



This homework assignment is due next Thursday, at midnight. It deals with Object Oriented Programming, classes, and objects. The optional part deals classes containing lists of objects.

Bubbles, bubbles, bubbles

  • Write a program that is called hw11a.py, that is the continuation of Lab 11.
  • Your program should have a class for a fish, as you did in Lab 11.
  • In the new program you need implement a new type of object which represents bubbles. A bubble is an object for which you have to declare a new class. One bubble = one object.
  • As fish move around they generate bubbles through their mouth. In other words, bubble will appear randomly and when they do, their center should be the mouth of the fish (or close to it). Then, as the simulation goes on, the fish moves slowly forward, and the bubble moves slowly upward.
  • When a fish disappears from the tank, because it moves out, it should reappear on the other side of the tank. Make sure this operation is life-like, i.e. we want to see the nose of the fish appear, then its head, then its body, then it's fully on the graphics window.
  • When a bubble disappears from the tank, it is removed from the simulation. You will very likely use a list to keep track of the bubbles, and as a bubble leaves the tank completely, it should be removed from the list.

Optional and Extra-Credit

  • Create a new class called School, which will contain the list of fish currently in the tank, and the list of bubbles.
  • You are free to decide how the simulation (main loop where the object moves) is implemented:
    • Either you create a function called by main() that contains a loop that moves the fish and the bubble, or
    • The School class contains a method that runs the simulation, moving all the fish and the bubble around.
  • If you do this program, call it hw11b.py.

Submission

 submit hw11 hw11a.py

and/or

 submit hw11 hw11b.py            (if you have done the extra credit question)

Something fun and unrelated

Monitoring a Cluster of Computers as a school of fish (U. Nebraska).
In this video, the researchers at U. of Nebraska decided to use fish swiming in a tank as a way of displaying what is going on with a cluster of many computers working on a large problem. All the computers are involved in a common computation. Each fish (as far as we can tell, given the lack of better information) represents a computer or a program running on a computer. As the user zooms in on a fish, a blue window pops up to give some vital information about that system's health. Fish change color and size indicating to indicate a change in status. One could imaging that green fish represent computers not doing much work, which orange fish represent computers loaded with work. It is interesting to see how researchers would use a school of fish as a way to indicate what is going on in a cluster of computers, and relying on human beings's ability to recognize visual clues quickly to understand what is going on quickly and accurately. This is certainly better than trying to have the same human beings read tons of log files containing the date and time of many different events occurring in the cluster.