Space Invaders

Earth is being invaded by martians. Here's a description of the Martian fleet:

  1. The Martians have some spaceships.
  2. Each spaceship is either a mother ship or a drone.
  3. A mother ship has a name, which is a String, a crew, which is a list of Martians, and a possibly-empty set of daughter ships, each of which is a spaceship.
  4. When we say the fleet of a spaceship, we mean her daughter ships and all their fleets.
  5. A Martian has a name, which is a string, and some other attributes, which are unspecified.

Write functions to accomplish the following tasks:

  1. Given a spaceship, how many Martians named "Mork" are in the crew of either the spaceship or its fleet?
  2. Given a spaceship, return another spaceship just like the original, except that all of the ships in its fleet who have a crewmember named "Mork" have been removed. When a ship is removed from the fleet, so are all its daughters.

Last modified: Thu Oct 9 16:20:35 Eastern Daylight Time 2014