Recent Changes - Search:
ECG Home

GitHub

People

Publications

Calendar

Projects

Fall 2017

Older Courses

Spring 2017

Fall 2016

Spring 2016

Fall 2015

Spring 2015

Fall 2014

Spring 2014

Fall 2013

Spring 2013

Fall 2012

Spring 2012

Fall 2011

Spring 2011

Fall 2010

Spring 2010

Fall 2009

Spring 2009

Fall 2008

Spring 2008

Fall 2007

HOWTOs

edit SideBar

PS3b

Home Assignments Lecture Blog Resources Discussion Group

N-Body Simulation

We'll are working through the Princeton assignment at http://www.cs.princeton.edu/courses/archive/fall13/cos126/assignments/nbody.html.

Here in Part B, we are adding physics simulation and animation to the program created in Part A.

  • Your Body class should be extended with mutators so that the physics simulation can modify the velocities of each object
  • You should implement a method named step which takes a time parameter (double seconds) and moves the Body object given its internal velocity for that much time
  • You may internally represent forces, or you may calculate these from outside the Body
  • Your main routine should keep track of elapsed time and terminate the simulation when time has elapsed beyond the time limit provided at the command line
  • You may optionally (+1 pt extra credit) display elapsed time on the main screen

Here are the particular assignment requirements for us, as the Princeton material assumes Java, and we are using C++:

  • You should build a command-line app which accepts the same parameters as the one specified, and reads the universe file from stdin. Name your executable NBody, so you would run it with e.g:
./NBody 157788000.0 25000.0 < planets.txt
  • Please submit all files needed to build your project: .cpp's, any header files, and a Makefile
  • Include the planets.txt file and all associated GIF images with your submission, in the proper directory structure as required by your code
  • Fill out and include this ps3b-readme.txt file with your work
  • Make sure to do make clean before tarring up your code
  • Submit your work in a directory named ps3b

The TA should be able to type the following to run your code:

make
./NBody 157788000.0 25000.0 < planets.txt

Submitting

Submit your work via Bottlenose:

Martin section (201): https://grader.cs.uml.edu/assignments/481
Grinberg section (202): https://grader.cs.uml.edu/assignments/480

The executable file that your Makefile builds should be called NBody (the grading script checks that this executable builds successfully.)

Grading rubric

FeatureValueComment
core implementation8full & correct implementation=8 pts; nearly complete=6pts; part way=4 pts; started=2 pt
  1 planets revolve counter-clockwise (remember astronomical positive Y is SFML smaller Y
Makefile2Makefile included
  targets all and clean must exist
  all should build NBody
  must have dependencies correct
ps3b-readme.txt2 
Total12 
   
extra credit+1display elapsed time
 +1create new universe (and describe in readme)
 +1play sound file
Edit - History - Print - Recent Changes - Search
Page last modified on February 25, 2015, at 04:26 PM