C Coding Problem 2012

Introduction

The current year's problem is different from problems usually set for such programming contests. This particular problem was chosen to emphasis the importance of learning and manipulating graphical objects. The problem has the potential to be developed as a full-fledged C programming project.

The Problem Statement
Write a C programme to graphically display the relative motions of the sun, the earth and the moon.

Click on the image to see animation.

(The image is not to scale in distances and in time durations.)

(For some simple animations showing the relative motions of the sun, the earth click here.)

Explanatory remarks:

    1. The animated diagram displayed above shows the relative motions of the sun, the earth and the moon. The solution to the problem should be a C program which when compiled and executed should produce some such animation.
    2. The following are some of the features shown in the animation above;
      1. The sun has a fixed position. It is at the focus of an ellipse.
      2. The earth moves round the sun along the elliptical orbit and the sun is at one of the foci of this ellipse.
      3. The earth is rotating in its own axis. The axis of rotation is slightly inclined to the plane of the elliptical orbit.
      4. The hemisphere of the earth facing the sun is colored green indicating that in that half of earth's surface it is day-time.
      5. The hemisphere of the earth not facing the sun is colored black indicating that in that half of earth's surface it is night-time.
      6. It may be noticed that the earth moves faster when it is closer to sun. (This is a consequence of Kepler's laws of motion.)
      7. The moon is moving round the earth in a circular orbit with earth's center as center. The earth-moon system is moving round the sun.
      8. On the moon's surface, the hemisphere not facing the sun is colored black indicating that in that half of moon's surface it s night time.
      9. In other half of the moon it is day time.
      10. If you notice closely you can see a red spot on the moon's surface, This spot is always facing the earth. This is done to indicate that the moon always shows the same face to earth. (This is the case in the real world.)
    3. In the real world, the relative motions of the sun, the earth and the moon are much more complicated. The participants in the contest can, and definitely should, try to implement some additional features. A few possibilities are indicated below:
      1. It is not earth's center that is moving along the elliptical orbit. It is the center of mass of the earth-moon system that is moving along the elliptical orbit.
      2. The moon as viewed from the earth shows different phases beginning from new moon to full moon .
      3. One can include options for pausing, slowing down, speeding up, or, reversing the directions of motions.
      4. Twinkling stars could be added to the background.
  1. We believe that these features can be implemented using the commands in the graphics.h header file available with TurboC.
  2. We are happy to announce that even partial answers are acceptable. (For example, if elliptical orbit is too hard to simulate consider a circular orbit with sun at the center.) Thus, even if you are able to implement only some of the features listed above, you may submit the incomplete programme. No other contestant might have progressed as much as you!

Rules and Regulations

1. The code should be prefaced with the following comment lines with the required information:

/*

Name of Participant :

Class in which studying :

Name of College :

Address of College :

:

:

:

Address for communication :

:

:

:

e-mail id :

Contact Phone No (s). :

Operating system and compiler used :

*/

2. The programme should be named name.c where ‘name’ is to be replaced by a string of a maximum of eight characters indicating the name of the participant.

3. The programme should be compilable using standard C compilers (Linux/Windows).No other external header files are allowed.

4. The program code should be submitted as an email attachment to

vidyaccontest2012@gmail.com

not later than 02.00 p.m. on 31 October 2011.

5. If there are more than one nearly perfect solution five of the participants will be invited to Vidya Academy campus for making an oral chalk-and-duster presentation of their program.

6. While coming for the presentation, the participants should produce a certificate from the head of the department to the effect that the participant is a bonafide student of the affiliated college / university teaching department.

7. The following factors will be considered in awarding the prizes:

i. The logical accuracy of the program; whether the program performs the intended tasks without errors.

ii. The programming style: aesthetics, clarity, documentation, maintainability, etc.

iii. The time of receipt of solutions; in case of nearly identical solutions, the one received earlier maybe considered first for a prize.

iv. Oral presentation.

8. The contestants selected for oral presentations will have to make their own arrangements for travel to Vidya Academy for participating in the oral presentation. The date of the presentation will be communicated to the selected candidates at the earliest.

9. In all matters related to the contest, the decision of the organizing committee will be final.

End of rules and regulations.

Happy Coding !!!