Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-pro· GoogleHugging Face LMArena Human Preference 140K

Generate a website with an interactable version of the kerbal solar system.

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Googlegemma-3-27b-it’s answer.
  1. User

    Generate a website with an interactable version of the kerbal solar system.

  2. Gemini Assistant

    Of course! Here is a complete, self-contained website with an interactable Kerbal Solar System. The planets orbit at different speeds, and you can click on any celestial body (including moons!) to get more information about it.

    This code is broken down into three files: index.html, style.css, and script.js. Just save them all in the same folder and open index.html in your browser.


    1. The HTML File (index.html)

    This file sets up the structure of the page, including the main container for the solar system and the side panel for information.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Interactive Kerbal Solar System</title>
        <link rel="stylesheet" href="style.css">
        <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
    </head>
    <body>
    
        <div id="starfield"></div>
        <div id="starfield2"></div>
        <div id="starfield3"></div>
    
        <div class="main-container">
            <header>
                <h1>Interactive Kerbal Solar System</h1>
                <p>Click on any celestial body to learn more about it.</p>
            </header>
    
            <div id="solar-system-container">
                <!-- The sun, planets, and moons will be generated here by JavaScript -->
            </div>
        </div>
    
        <div id="info-panel">
            <div id="info-content">
                <h2 id="info-title">Select a Celestial Body</h2>
                <div class="info-body-vis">
                    <div id="info-icon"></div>
                </div>
                <p id="info-description">Click on a planet, moon, or Kerbol itself to see its details here.</p>
                <div id="info-stats">
                    <!-- Stats will be populated here -->
                </div>
            </div>
        </div>
    
        <script src="script.js"></script>
    </body>
    </html>
    

    2. The CSS File (style.css)

    This file handles all the styling, including the dark theme, the orbits, the planet appearances, and the animations.

    /* --- Basic Setup & Starfield Background --- */
    body {
        background-color: #000;
        color: #e0e0e0;
        font-family: 'Roboto', sans-serif;
        margin: 0;
        padding: 0;
        overflow: hidden; /* Hide scrollbars */
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
    
    @keyframes move-twinkle-back {
        from { background-position: 0 0; }
        to { background-position: -10000px 5000px; }
    }
    
    #starfield, #starfield2, #starfield3 {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: transparent;
    }
    
    #starfield {
        background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiIHZpZXdCb3g9IjAgMCA2IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDYgNiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTMsMEwwLDNMMiwzTDMsMkw0LDNMNiwzTDMsMFoiLz48L3N2Zz4=');
        animation: move-twinkle-back 200s linear infinite;
    }
    
    #starfield2 {
        background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjRweCIgaGVpZ2h0PSI0cHgiIHZpZXdCb3g9IjAgMCA0IDQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDQgNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTIsMEwwLDJMMiw0TDQsMkwyLDBaIi8+PC9zdmc+');
        animation: move-twinkle-back 150s linear infinite;
    }
    
    #starfield3 {
        background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjJweCIgaGVpZ2h0PSIycHgiIHZpZXdCb3g9IjAgMCAyIDIiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDIgMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHJlY3QgZmlsbD0iI0ZGRiIgd2lkdGg9IjIiIGhlaWdodD0iMiIvPjwvc3ZnPg==');
        animation: move-twinkle-back 100s linear infinite;
    }
    
    /* --- Main Layout & Header --- */
    .main-container {
        position: relative;
        width: 95vw;
        height: 95vh;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    header {
        position: absolute;
        top: 20px;
        left: 20px;
        z-index: 1000;
        text-shadow: 0 0 5px black;
    }
    
    header h1 {
        margin: 0;
        font-weight: 700;
    }
    header p {
        margin: 5px 0 0 0;
        font-weight: 300;
        color: #aaa;
    }
    
    /* --- Solar System --- */
    #solar-system-container {
        position: relative;
        width: 90vmin; /* vmin = smaller of vw or vh */
        height: 90vmin;
        transform-style: preserve-3d;
    }
    
    /* Base style for all celestial bodies */
    .celestial-body {
        position: absolute;
        border-radius: 50%;
        cursor: pointer;
        transition: box-shadow 0.3s ease, transform 0.3s ease;
        display: flex; /* For centering moons */
        justify-content: center;
        align-items: center;
    }
    
    .celestial-body:hover {
        transform: scale(1.2);
        z-index: 100;
    }
    
    .celestial-body.selected {
        box-shadow: 0 0 15px 5px #fff, 0 0 30px 10px #0ff;
        z-index: 99;
    }
    
    /* --- Orbits & Animation --- */
    .orbit {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border: 1px dashed rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        transform-style: preserve-3d;
        animation: orbit linear infinite;
    }
    
    /* The planet itself sits on the edge of the orbit path */
    .orbit > .celestial-body {
        top: -15px; /* Adjust to center based on planet size */
        left: 50%;
        transform-origin: center;
    }
    
    @keyframes orbit {
        from { transform: translate(-50%, -50%) rotate(0deg); }
        to { transform: translate(-50%, -50%) rotate(360deg); }
    }
    
    /* --- Info Panel --- */
    #info-panel {
        position: fixed;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 320px;
        max-height: 90vh;
        background: rgba(10, 20, 30, 0.85);
        backdrop-filter: blur(5px);
        border: 1px solid #304050;
        border-radius: 10px;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
        z-index: 1001;
        overflow-y: auto;
    }
    
    #info-content {
        padding: 20px;
    }
    
    #info-title {
        margin: 0 0 15px 0;
        font-size: 1.8em;
        color: #00d8ff;
        text-align: center;
        border-bottom: 1px solid #304050;
        padding-bottom: 10px;
    }
    
    .info-body-vis {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 15px;
        min-height: 80px;
    }
    
    #info-icon {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    }
    
    #info-description {
        font-weight: 300;
        line-height: 1.5;
        margin-bottom: 20px;
    }
    
    #info-stats {
        border-top: 1px solid #304050;
        padding-top: 15px;
    }
    
    #info-stats p {
        display: flex;
        justify-content: space-between;
        margin: 8px 0;
        font-size: 0.9em;
    }
    
    #info-stats strong {
        font-weight: 400;
        color: #99aacc;
    }
    
    /* --- Responsive Design for Mobile --- */
    @media (max-width: 768px) {
        body {
            flex-direction: column;
            overflow: auto;
        }
        .main-container {
            width: 100%;
            height: auto;
            min-height: 60vh;
        }
        #solar-system-container {
            width: 95vmin;
            height: 95vmin;
            margin-top: 80px;
        }
        header {
            width: calc(100% - 40px);
            text-align: center;
        }
        #info-panel {
            position: relative;
            width: 90%;
            right: auto;
            top: auto;
            transform: none;
            margin: 20px auto;
        }
    }
    

    3. The JavaScript File (script.js)

    This is the core of the project. It contains all the data for the celestial bodies and includes the logic to dynamically generate the system and handle user interactions.

    document.addEventListener('DOMContentLoaded', () => {
    
        // Data for all celestial bodies in the Kerbal system
        // Sizes and distances are scaled for display purposes, not realism.
        const celestialBodies = [
            {
                id: 'kerbol',
                name: 'Kerbol',
                description: 'The star at the center of the Kerbol system. It is the primary source of light and heat. All other celestial bodies orbit it.',
                stats: { 'Type': 'G-type main-sequence star', 'Gravity': '17.1 g', 'Solar Day': 'N/A' },
                display: { size: 100, color: 'linear-gradient(45deg, #ffcc00, #ff6600)', orbitalRadius: 0, orbitalPeriod: 0 },
                isSun: true
            },
            {
                id: 'moho',
                name: 'Moho',
                description: 'The innermost planet, analogous to Mercury. Its scorched surface and lack of atmosphere make it a challenging destination.',
                stats: { 'Gravity': '0.27 g', 'Atmosphere': 'None', 'Semi-Major Axis': '5,263 Mm' },
                display: { size: 10, color: '#8B4513', orbitalRadius: 18, orbitalPeriod: 10 }
            },
            {
                id: 'eve',
                name: 'Eve',
                description: 'A purple planet with a very dense, high-pressure atmosphere and vast liquid oceans. Similar to Venus, landing and returning from Eve is famously difficult.',
                stats: { 'Gravity': '1.7 g', 'Atmosphere': '5 atm', 'Semi-Major Axis': '9,832 Mm' },
                display: { size: 28, color: '#6A0DAD', orbitalRadius: 28, orbitalPeriod: 15 },
                moons: [
                    {
                        id: 'gilly',
                        name: 'Gilly',
                        description: 'Eve\'s tiny, captured asteroid moon. It has extremely low gravity, making it tricky to land on without accidentally achieving escape velocity.',
                        stats: { 'Gravity': '0.005 g', 'Atmosphere': 'None', 'Semi-Major Axis': '31.5 Mm' },
                        display: { size: 4, color: '#A9A9A9', orbitalRadius: 25, orbitalPeriod: 3 }
                    }
                ]
            },
            {
                id: 'kerbin',
                name: 'Kerbin',
                description: 'The home planet of the Kerbals. A comfortable, Earth-like world with oceans, continents, and a breathable atmosphere.',
                stats: { 'Gravity': '1 g', 'Atmosphere': '1 atm', 'Semi-Major Axis': '13,599 Mm' },
                display: { size: 25, color: '#2E8B57', orbitalRadius: 40, orbitalPeriod: 25 },
                moons: [
                    {
                        id: 'mun',
                        name: 'Mun',
                        description: 'Kerbin\'s largest moon, analogous to Earth\'s Moon. It is a common first destination for new space programs.',
                        stats: { 'Gravity': '0.165 g', 'Atmosphere': 'None', 'Semi-Major Axis': '12 Mm' },
                        display: { size: 8, color: '#CCCCCC', orbitalRadius: 22, orbitalPeriod: 4 }
                    },
                    {
                        id: 'minmus',
                        name: 'Minmus',
                        description: 'Kerbin\'s smaller, more distant moon. Its mint-green color comes from crystalline deposits, and its low gravity makes it an ideal spot for refueling.',
                        stats: { 'Gravity': '0.05 g', 'Atmosphere': 'None', 'Semi-Major Axis': '47 Mm' },
                        display: { size: 5, color: '#AFEEEE', orbitalRadius: 35, orbitalPeriod: 10 }
                    }
                ]
            },
            {
                id: 'duna',
                name: 'Duna',
                description: 'The red planet of the Kerbol system, analogous to Mars. It has a thin atmosphere and polar ice caps.',
                stats: { 'Gravity': '0.3 g', 'Atmosphere': '0.2 atm', 'Semi-Major Axis': '20,725 Mm' },
                display: { size: 20, color: '#C1440E', orbitalRadius: 55, orbitalPeriod: 40 },
                moons: [
                    {
                        id: 'ike',
                        name: 'Ike',
                        description: 'Duna\'s large, grey moon. It is tidally locked to Duna, meaning one side always faces the planet.',
                        stats: { 'Gravity': '0.11 g', 'Atmosphere': 'None', 'Semi-Major Axis': '3.2 Mm' },
                        display: { size: 6, color: '#888888', orbitalRadius: 18, orbitalPeriod: 6 }
                    }
                ]
            },
            {
                id: 'jool',
                name: 'Jool',
                description: 'A massive green gas giant, analogous to Jupiter. It has no solid surface to land on, but it hosts a large system of five diverse moons.',
                stats: { 'Gravity': '0.8 g (at cloud tops)', 'Atmosphere': '15 atm', 'Semi-Major Axis': '68,773 Mm' },
                display: { size: 60, color: 'radial-gradient(circle, #556B2F, #3B4A2F)', orbitalRadius: 80, orbitalPeriod: 100 },
                moons: [
                    { id: 'laythe', name: 'Laythe', description: 'An ocean moon with a breathable atmosphere, making it a prime candidate for colonization.', stats: {}, display: { size: 10, color: '#367588', orbitalRadius: 20, orbitalPeriod: 8 } },
                    { id: 'vall', name: 'Vall', description: 'A pale blue, ice-covered moon reminiscent of Europa.', stats: {}, display: { size: 8, color: '#ADD8E6', orbitalRadius: 30, orbitalPeriod: 14 } },
                    { id: 'tylo', name: 'Tylo', description: 'A massive, high-gravity moon with no atmosphere, making it the ultimate landing challenge.', stats: {}, display: { size: 12, color: '#F0EAD6', orbitalRadius: 45, orbitalPeriod: 22 } },
                    { id: 'bop', name: 'Bop', description: 'A small, lumpy captured asteroid with an eccentric orbit.', stats: {}, display: { size: 5, color: '#967969', orbitalRadius: 58, orbitalPeriod: 35 } },
                    { id: 'pol', name: 'Pol', description: 'A small, pollen-like moon with a strange, spiky surface.', stats: {}, display: { size: 4, color: '#D2B48C', orbitalRadius: 70, orbitalPeriod: 50 } }
                ]
            },
            {
                id: 'eeloo',
                name: 'Eeloo',
                description: 'A distant, icy dwarf planet analogous to Pluto. Its highly elliptical and inclined orbit makes it a difficult target to reach.',
                stats: { 'Gravity': '0.17 g', 'Atmosphere': 'None', 'Semi-Major Axis': '90,118 Mm' },
                display: { size: 9, color: '#E0FFFF', orbitalRadius: 95, orbitalPeriod: 180 }
            }
        ];
    
        const solarSystemContainer = document.getElementById('solar-system-container');
        const infoPanel = {
            title: document.getElementById('info-title'),
            icon: document.getElementById('info-icon'),
            description: document.getElementById('info-description'),
            stats: document.getElementById('info-stats')
        };
    
        function createCelestialBody(bodyData, parentElement) {
            const bodyElement = document.createElement('div');
            bodyElement.id = bodyData.id;
            bodyElement.className = 'celestial-body';
            bodyElement.style.width = `${bodyData.display.size}px`;
            bodyElement.style.height = `${bodyData.display.size}px`;
            bodyElement.style.background = bodyData.display.color;
    
            // Center the sun
            if (bodyData.isSun) {
                bodyElement.style.top = `calc(50% - ${bodyData.display.size / 2}px)`;
                bodyElement.style.left = `calc(50% - ${bodyData.display.size / 2}px)`;
            } else {
                 bodyElement.style.top = `calc(0% - ${bodyData.display.size / 2}px)`;
                 bodyElement.style.left = `calc(50% - ${bodyData.display.size / 2}px)`;
            }
    
            bodyElement.addEventListener('click', (e) => {
                e.stopPropagation(); // Prevent clicks from bubbling up to parent orbits
                showInfo(bodyData);
            });
    
            parentElement.appendChild(bodyElement);
    
            // If the body has moons, create them relative to this body
            if (bodyData.moons && bodyData.moons.length > 0) {
                bodyData.moons.forEach(moonData => {
                    const orbitElement = createOrbit(moonData.display.orbitalRadius, moonData.display.orbitalPeriod);
                    createCelestialBody(moonData, orbitElement);
                    bodyElement.appendChild(orbitElement); // Append moon's orbit to the parent planet
                });
            }
        }
    
        function createOrbit(radiusPercentage, period) {
            const orbitElement = document.createElement('div');
            orbitElement.className = 'orbit';
            const diameter = radiusPercentage * 2;
            orbitElement.style.width = `${diameter}%`;
            orbitElement.style.height = `${diameter}%`;
            orbitElement.style.animationDuration = `${period}s`;
            return orbitElement;
        }
    
        function generateSystem() {
            celestialBodies.forEach(bodyData => {
                if (bodyData.isSun) {
                    createCelestialBody(bodyData, solarSystemContainer);
                } else {
                    const orbitElement = createOrbit(bodyData.display.orbitalRadius, bodyData.display.orbitalPeriod);
                    createCelestialBody(bodyData, orbitElement);
                    solarSystemContainer.appendChild(orbitElement);
                }
            });
        }
    
        function showInfo(bodyData) {
            // Remove 'selected' class from any currently selected body
            const currentSelected = document.querySelector('.celestial-body.selected');
            if (currentSelected) {
                currentSelected.classList.remove('selected');
            }
    
            // Add 'selected' class to the new body
            document.getElementById(bodyData.id).classList.add('selected');
    
            // Update info panel
            infoPanel.title.textContent = bodyData.name;
            infoPanel.icon.style.background = bodyData.display.color;
            infoPanel.icon.style.width = '80px';
            infoPanel.icon.style.height = '80px';
            infoPanel.description.textContent = bodyData.description;
    
            infoPanel.stats.innerHTML = ''; // Clear previous stats
            if (bodyData.stats) {
                for (const [key, value] of Object.entries(bodyData.stats)) {
                    const statElement = document.createElement('p');
                    statElement.innerHTML = `<strong>${key}:</strong> <span>${value}</span>`;
                    infoPanel.stats.appendChild(statElement);
                }
            }
        }
    
        // Initial setup
        generateSystem();
        // Show Kerbin info by default
        const kerbinData = celestialBodies.find(b => b.id === 'kerbin');
        if (kerbinData) {
            showInfo(kerbinData);
        }
    });
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.