Page 1 of 1

Solar System Calculator

Posted: Fri Sep 27, 2024 8:28 am
by voidstar
Adapted from a prior PET example, this calculates how far along a fence to draw the planets at scale to each other.

The two inputs are how long is your fence (in feet) and how many planets you want to include in your model (1-9, yep I included Pluto anyway).

However, planet orbits aren't perfectly circular - they will have a min (nearest to sun) distance, max (furthest from sun), and an average distance to the sun. This program calculates all 3 of those, so you can choose which one to use in your fence model (I'd generally use average).

There is an Easter Egg in this program if you use inputs "108" and "8" (fence length 108 and 8 planets), exclusive to the X16 :) (however it requires the R48 ROM update, due to using OVAL and RING - since BASIC is interpreted on the fly, you can run the rest of the program with older ROM -- the TryItNow emulator is not yet updated to R48)


Try It Now!

Re: Solar System Calculator

Posted: Fri Sep 27, 2024 8:39 am
by voidstar
Here is an example of the normal runtime:

Say you have a 40ft fence along your backyard, and you want to depict a model of the first 8 planets. Alternatively, if you didn't much care about the outer planets, you could just put 4.

Then the program calculates how many inches from the edge of the fence that each planet should be drawn, in order to accurately maintain a scaled model of the N chosen planets. The first column in the results is the MIN distance, then MAX distance, and the last column is the AVERAGE distance.

In this specific example, Mercury would be 5inches (almost half a foot), while NEPTUNE would be at 39.5ft (using the last column, the average overall distance from the sun). The distances are scaled to the planets max range.


The program is an example of using multiple DATA sections. It can work "as-is" but the "Easter Egg" special (108ft 8 planets) uses OVAL and RING keywords that require ROM R48 update.

ssc_example.jpg
ssc_example.jpg (143.66 KiB) Viewed 90 times