The first law allows for user input in the form of four buttons that can be pressed. As seen below, the options for the user are for either of the two planets to orbit, both planets at once, or neither planet.
Each button calls a different function, all of which define the same objects in the scene. They differ in the fact that the only objects that are assigned non-zero velocity vectors are the ones that are selected by the user. For example, if the all button is pressed then the all function is executed and both planets begin to orbit.
The rest of the functions are written in an extremely similar manner so showing the code for each would be a little pointless. As for all of the code that is not contained by any function, the majority of it is very basic. At the beginning of the program all constants are defined and sun and both planets are created, placed, and given features such as a texture and a trail. The window for the controls is also defined here, with a specified place and size. After the functions are defined, they are all assigned to the action method of their respective buttons.
As stated in the narrative, there are actually two different programs in order to visualize the second part. The first does not actually show the amount of area covered, but you can still see that each area being swept out is the same. This program does feature randomly generated orbits, however, so a plethora of orbits can be observed and examined. The second version of the program only contains a few pre-determined orbits that can be selected by the user. These orbits look almost entirely the same, except for the fact that instead of displaying the initial speed they will display the area swept out by each of the time periods. The reason that there are only a few orbits to choose from is that each of the areas had to be calculated by hand and separately entered into the program.
The visual differences are very obvious when looking at the two programs, and the only other difference in the code was the amounts of orbits available. The first part uses the random() function in order to create a large amount of different initial velocities and therefore different orbits. The second part uses np.random.choice() in order to randomly choose a starting velocity from an already defined list.
Difficulties were encountered when writing the code for the third law and there is no final product as a result. These difficulties are discussed further in the narrative, which can be found on the documents page of the website!