6.3 Character processing6 Assignments6.1 Getting Started 16.2 Robots

6.2 Robots

This program will probably use the while loop.

You are in charge of a moon colonization program. It has been determined that the only way to do the project is with robots. The robots know how to build more robots. After there are enough robots people can also be sent to the moon.

Each robot collects materials for two (2) months. During this time it has collected enough materials to build three (3) robots. It takes one month to build a robot. As soon as it is built (and running) it starts collecting materials to build robots its self.

The robot that just finished building the three(3) robots will normally start collecting materials again too.

Stop collecting new material for robots when you have 200 or more robots. Some robots will move directly from being built to being idle. So if the total number of robots at the end of one month equals or exceeds 200, no robots should start collecting the following month. If a robot had started collecting material, let the robot complete its cycle.

Start with one(1) robot, but use a preprocessor #define statement to set this value.

Write a program that computes the number of robots and keeps track of what they are doing each month.

Print out the number of robots at the beginning of each month. The total should include both old robots and the robots that have just been built and their assignments.

This means that the forst month that shows the total number of robots greater than or equal to 200 robots should also show a decline in the number of collecting robots.

Your program need to print the following:

Other requirments:

Hint:

c1=1;
while( c1+c2+b1+b2+b3 )
  {
  }

Study areas:

Extra credit:

Make sure that your program runs until all of the robots are idle. Mark your output with:

Please turn your lab in to Pima Community College employee in room A-115 ofthe Santa Rita Building. Ask them to place it in the lab folder in Louis Taber's mailbox.
Instructor: ltaber@pima.edu ** My new Home at GeoApps in Tucson ** The Pima College Site

6.3 Character processing6 Assignments6.1 Getting Started 16.2 Robots