examples/n-body/README.md
A program representing an N-body simulation of five planetary bodies: Sun, Jupiter, Saturn, Uranus, and Neptune.
With a minimal Pony installation, in the same directory as this README file run ponyc. You should see content building the necessary packages, which ends with:
...
Generating
Reachability
Selector painting
Data prototypes
Data types
Function prototypes
Functions
Descriptors
Optimising
Writing ./n-body.o
Linking ./n-body
Once n-body has been compiled, in the same directory as this README file run ./n-body. You should a measurement of the initial energy of the system. The program will continue running for a set number of cycles (by default, 50000000) then print the resulting energy of the system.
$ ./n-body
-0.169075
-0.16906
To create a run which runs for a different number of cycles, provide a numeric argument.
./n-body 100000000
-0.169075
-0.169035
The above run doubles the default number of cycles.
Modify the program to make Body a trait/interface and create classes for Sun, Jupiter, Saturn, Uranus, and Neptune which satisfy Body.