Saturday, September 17, 2016

More star system fun

In my last post, I mentioned how I had created a C# version of the venerable Accrete star system simulation program, using Ian Burdell's Java applet variant as a template.  The StarGen variant has more planetary details, like orbital period (year), planetary radius, axial tilt, etc., plus moons.  Alas, when I began coding calculations for these details myself, I didn't make it past coding up four of the calculations before I discovered the main algorithms needed to be enhanced to track gas and dust masses separately in order to provide the necessary data for a few of the subsequent calculations... whose results are required as inputs for most of the remaining calculations.  [sigh]

That's not complete yet, so there's nothing new to show at this point.  This is taking longer than it would otherwise because I'm also doing some code cleanup.  When I wrote my initial code based upon the C and Java code by others, I used the basic data structures they'd used, including old-school singly-linked lists.  I've been replacing all such data structures with C# generic collections, particularly List.  With those changes in place, many routines were shortened, some by as much as 60%, since a number of code loops were replaced by LINQ queries.  Of course, under the hood the LINQ queries will be turned into similar looping code, but it is much easier to read when reviewing the source code.

Hopefully I'll have time to finish up the changes for tracking gas and dust masses separately.  With those in place, the rest of the calculations can be performed, and I should be able to have more detailed temperatures, radius, day length, planet type, etc.  For now, I'm going to do a bit of reading, then get some sleep.  Good night, world.

No comments:

Post a Comment