moons 0.0.3

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use std::thread;
use std::time::Duration;

fn main() {
    let earth = moons::interactions::earths::ensure_earths_binary_or_simulate();
    let orbit = moons::physics::orbit::LunarOrbit::new();
    let rotation = moons::physics::rotation::MoonRotation::new();
    let landing_site = moons::geodata::landing_sites::apollo_11();
    let exosphere = moons::exosphere::species::reference_composition();
    let thermal = moons::environment::thermal::ThermalEnvironment {
        local_time_hours: moons::LUNAR_DAY_HOURS * 0.5,
        latitude_deg: landing_site.latitude_deg,
        shadowed: false,
    };
    let ice = moons::resources::ice::shackleton_candidate();
    let earth_view = moons::observation::earth_view::EarthView::near_side_default();
    let thermal_k = thermal.surface_temperature_k();
    let startup_score = moons::H24_RUNTIME_HOURS as f64
        + earth.orbital_radius_km / 1.0e6
        + earth.orbital_period_days / 365.0
        + earth.orbital_angle_deg / 360.0
        + earth.rotation_period_h / 24.0
        + earth.rotation_angle_deg / 360.0
        + earth.axial_tilt_deg / 90.0
        + earth.surface_speed_m_s / 1_000.0
        + orbit.semi_major_axis_m / 1.0e9
        + orbit.orbital_period_s() / 1.0e6
        + rotation.sidereal_period_s / 1.0e6
        + landing_site.latitude_deg.abs() / 90.0
        + landing_site.longitude_deg.abs() / 180.0
        + exosphere.len() as f64
        + thermal_k / 1_000.0
        + ice.estimated_mass_kg.log10().max(0.0)
        + if earth_view.is_visible() { 1.0 } else { 0.0 }
        + if landing_site.name.is_empty() {
            0.0
        } else {
            1.0
        }
        + if matches!(
            earth.mode,
            moons::interactions::earths::EarthRuntimeMode::Binary
        ) {
            1.0
        } else {
            0.5
        };
    let heartbeat = if startup_score.is_finite() && startup_score > 0.0 {
        Duration::from_secs(60)
    } else {
        Duration::from_secs(5)
    };

    loop {
        thread::sleep(heartbeat);
    }
}