Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

Make me an interactive html5 page that simulates what it's like to drive a manual. There…

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

    Make me an interactive html5 page that simulates what it's like to drive a manual. There should be a stick shift that the user needs to move to change gears by dragging it with the mouse, w should be gas pedal, s should be brake pedal, q should be clutch, include the ability to redline, stall, and damage gears.

  2. Assistant

    Sure! Below is a complete interactive HTML5 page that simulates driving a manual transmission car with the features you requested:

    • A draggable stick shift to change gears.
    • W key for gas pedal.
    • S key for brake pedal.
    • Q key for clutch.
    • Ability to redline (engine RPM limit).
    • Ability to stall the engine if clutch is not pressed when starting from 0.
    • Damage gears if shifting incorrectly.

    How it works:

    • Drag the stick shift to change gears (positions: Neutral, 1, 2, 3, 4, 5).
    • Press and hold Q to press the clutch.
    • Press and hold W to accelerate.
    • Press and hold S to brake.
    • If you try to accelerate without clutch in 1st gear from 0 speed, the engine stalls.
    • If you shift gears without clutch pressed or shift too fast at high RPM, the gear gets damaged.
    • RPM increases with gas and decreases with no gas.
    • Redline is at 7000 RPM; going over damages the engine.

    Code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Manual Transmission Simulator</title>
    <style>
      body {
        font-family: Arial, sans-serif;
        background: #222;
        color: #eee;
        margin: 0;
        overflow: hidden;
        user-select: none;
      }
      #container {
        width: 600px;
        margin: 20px auto;
        background: #333;
        border-radius: 10px;
        padding: 20px;
        box-sizing: border-box;
      }
      h1 {
        text-align: center;
        margin-bottom: 10px;
      }
      #stickShift {
        width: 120px;
        height: 120px;
        background: #555;
        border-radius: 50%;
        margin: 20px auto;
        position: relative;
        cursor: grab;
        user-select: none;
      }
      #stickKnob {
        width: 30px;
        height: 30px;
        background: #ccc;
        border-radius: 50%;
        position: absolute;
        top: 45px;
        left: 45px;
        cursor: grab;
      }
      #gearPositions {
        width: 120px;
        height: 120px;
        margin: 0 auto;
        position: relative;
      }
      .gearLabel {
        position: absolute;
        width: 30px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        font-weight: bold;
        color: #aaa;
        user-select: none;
      }
      .gearLabel.active {
        color: #0f0;
        font-weight: bolder;
      }
      #gearN { top: 45px; left: 45px; }
      #gear1 { top: 10px; left: 10px; }
      #gear2 { top: 80px; left: 10px; }
      #gear3 { top: 10px; left: 80px; }
      #gear4 { top: 80px; left: 80px; }
      #gear5 { top: 45px; left: 110px; }
    
      #info {
        margin-top: 20px;
        font-size: 16px;
        line-height: 1.4;
      }
      #pedals {
        margin-top: 20px;
        display: flex;
        justify-content: space-around;
      }
      .pedal {
        width: 100px;
        height: 50px;
        background: #444;
        border-radius: 8px;
        text-align: center;
        line-height: 50px;
        font-weight: bold;
        color: #ccc;
        user-select: none;
        transition: background 0.3s;
      }
      .pedal.active {
        background: #0a0;
        color: #fff;
      }
      .pedal.brake.active {
        background: #a00;
      }
      .pedal.clutch.active {
        background: #00a;
      }
      #status {
        margin-top: 15px;
        font-weight: bold;
        font-size: 18px;
        text-align: center;
        height: 24px;
      }
    </style>
    </head>
    <body>
    <div id="container">
      <h1>Manual Transmission Simulator</h1>
      <div id="gearPositions">
        <div id="gearN" class="gearLabel active">N</div>
        <div id="gear1" class="gearLabel">1</div>
        <div id="gear2" class="gearLabel">2</div>
        <div id="gear3" class="gearLabel">3</div>
        <div id="gear4" class="gearLabel">4</div>
        <div id="gear5" class="gearLabel">5</div>
      </div>
      <div id="stickShift" title="Drag the knob to change gears">
        <div id="stickKnob"></div>
      </div>
      <div id="pedals">
        <div id="clutchPedal" class="pedal clutch">Q: Clutch</div>
        <div id="brakePedal" class="pedal brake">S: Brake</div>
        <div id="gasPedal" class="pedal gas">W: Gas</div>
      </div>
      <div id="info">
        <p>Speed: <span id="speed">0</span> km/h</p>
        <p>RPM: <span id="rpm">0</span></p>
        <p>Gear: <span id="currentGear">Neutral</span></p>
      </div>
      <div id="status"></div>
    </div>
    
    <script>
    (() => {
      const stickShift = document.getElementById('stickShift');
      const stickKnob = document.getElementById('stickKnob');
      const gearLabels = {
        N: document.getElementById('gearN'),
        1: document.getElementById('gear1'),
        2: document.getElementById('gear2'),
        3: document.getElementById('gear3'),
        4: document.getElementById('gear4'),
        5: document.getElementById('gear5'),
      };
      const speedDisplay = document.getElementById('speed');
      const rpmDisplay = document.getElementById('rpm');
      const gearDisplay = document.getElementById('currentGear');
      const statusDisplay = document.getElementById('status');
      const clutchPedal = document.getElementById('clutchPedal');
      const brakePedal = document.getElementById('brakePedal');
      const gasPedal = document.getElementById('gasPedal');
    
      // Gear positions relative to stickShift container (x,y)
      // These correspond to the center of the knob for each gear
      const gearPositions = {
        N: { x: 60, y: 60 },
        1: { x: 25, y: 25 },
        2: { x: 25, y: 95 },
        3: { x: 95, y: 25 },
        4: { x: 95, y: 95 },
        5: { x: 120, y: 60 }, // Slightly outside circle to right
      };
    
      // State variables
      let currentGear = 'N';
      let clutchPressed = false;
      let gasPressed = false;
      let brakePressed = false;
      let speed = 0; // km/h
      let rpm = 0;
      let engineRunning = true;
      let gearDamaged = {
        1: false,
        2: false,
        3: false,
        4: false,
        5: false,
      };
      let engineDamaged = false;
      let lastShiftTime = 0;
      let lastGear = 'N';
    
      // Constants
      const maxRPM = 7000;
      const redlineRPM = 6500;
      const stallRPM = 800;
      const idleRPM = 700;
      const maxSpeedPerGear = {
        1: 30,
        2: 60,
        3: 90,
        4: 130,
        5: 180,
      };
      const accelerationRate = 0.3; // km/h per frame when gas pressed
      const decelerationRate = 0.2; // km/h per frame when no gas
      const brakeRate = 1.0; // km/h per frame when brake pressed
      const rpmIncreaseRate = 150; // RPM per frame when gas pressed
      const rpmDecreaseRate = 200; // RPM per frame when no gas
      const rpmDropOnShift = 1000; // RPM drop when shifting gears
    
      // Dragging variables
      let dragging = false;
      let dragOffset = { x: 0, y: 0 };
    
      // Utility: distance between two points
      function dist(x1, y1, x2, y2) {
        return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
      }
    
      // Find closest gear based on knob position
      function findClosestGear(x, y) {
        let closestGear = 'N';
        let minDist = Infinity;
        for (const [gear, pos] of Object.entries(gearPositions)) {
          const d = dist(x, y, pos.x, pos.y);
          if (d < minDist) {
            minDist = d;
            closestGear = gear;
          }
        }
        return closestGear;
      }
    
      // Update gear labels highlight
      function updateGearLabels() {
        for (const [gear, label] of Object.entries(gearLabels)) {
          if (gear === currentGear) {
            label.classList.add('active');
          } else {
            label.classList.remove('active');
          }
          if (gearDamaged[gear]) {
            label.style.color = '#a00';
          } else if (!label.classList.contains('active')) {
            label.style.color = '#aaa';
          }
        }
      }
    
      // Update stick knob position based on current gear
      function updateStickPosition() {
        const pos = gearPositions[currentGear];
        stickKnob.style.left = (pos.x - 15) + 'px'; // knob is 30x30, center it
        stickKnob.style.top = (pos.y - 15) + 'px';
      }
    
      // Update displays
      function updateDisplays() {
        speedDisplay.textContent = speed.toFixed(1);
        rpmDisplay.textContent = Math.round(rpm);
        gearDisplay.textContent = currentGear === 'N' ? 'Neutral' : currentGear;
      }
    
      // Show status message
      function setStatus(msg, color = '#0f0') {
        statusDisplay.textContent = msg;
        statusDisplay.style.color = color;
      }
    
      // Clear status message
      function clearStatus() {
        statusDisplay.textContent = '';
      }
    
      // Handle gear damage
      function damageGear(gear) {
        if (gear === 'N') return;
        gearDamaged[gear] = true;
        setStatus(`Gear ${gear} damaged! Shift carefully!`, '#a00');
      }
    
      // Handle engine damage
      function damageEngine() {
        engineDamaged = true;
        setStatus('Engine damaged! Simulation over.', '#a00');
      }
    
      // Stall engine
      function stallEngine() {
        engineRunning = false;
        rpm = 0;
        speed = 0;
        setStatus('Engine stalled! Press Q (clutch) and restart.', '#a00');
      }
    
      // Restart engine
      function restartEngine() {
        if (!engineRunning) {
          engineRunning = true;
          rpm = idleRPM;
          setStatus('Engine restarted.', '#0f0');
          setTimeout(clearStatus, 2000);
        }
      }
    
      // Handle key states
      const keys = {
        q: false,
        w: false,
        s: false,
      };
    
      function updatePedalVisuals() {
        clutchPedal.classList.toggle('active', keys.q);
        gasPedal.classList.toggle('active', keys.w);
        brakePedal.classList.toggle('active', keys.s);
      }
    
      // Event listeners for keys
      window.addEventListener('keydown', e => {
        if (e.repeat) return;
        if (e.key.toLowerCase() === 'q') {
          keys.q = true;
          clutchPressed = true;
          updatePedalVisuals();
          if (!engineRunning) restartEngine();
        }
        if (e.key.toLowerCase() === 'w') {
          keys.w = true;
          gasPressed = true;
          updatePedalVisuals();
        }
        if (e.key.toLowerCase() === 's') {
          keys.s = true;
          brakePressed = true;
          updatePedalVisuals();
        }
      });
      window.addEventListener('keyup', e => {
        if (e.key.toLowerCase() === 'q') {
          keys.q = false;
          clutchPressed = false;
          updatePedalVisuals();
        }
        if (e.key.toLowerCase() === 'w') {
          keys.w = false;
          gasPressed = false;
          updatePedalVisuals();
        }
        if (e.key.toLowerCase() === 's') {
          keys.s = false;
          brakePressed = false;
          updatePedalVisuals();
        }
      });
    
      // Dragging stick knob
      stickKnob.addEventListener('mousedown', e => {
        dragging = true;
        dragOffset.x = e.clientX;
        dragOffset.y = e.clientY;
        stickKnob.style.cursor = 'grabbing';
        e.preventDefault();
      });
      window.addEventListener('mouseup', e => {
        if (dragging) {
          dragging = false;
          stickKnob.style.cursor = 'grab';
          // Snap to closest gear
          const rect = stickShift.getBoundingClientRect();
          const knobRect = stickKnob.getBoundingClientRect();
          const x = knobRect.left + knobRect.width / 2 - rect.left;
          const y = knobRect.top + knobRect.height / 2 - rect.top;
          const newGear = findClosestGear(x, y);
    
          // Check gear damage and clutch
          const now = performance.now();
          if (newGear !== currentGear) {
            if (!clutchPressed) {
              damageGear(newGear);
              setStatus('Shifted without clutch! Gear damaged.', '#a00');
            } else if (now - lastShiftTime < 500 && rpm > redlineRPM) {
              damageGear(newGear);
              setStatus('Shifted too fast at high RPM! Gear damaged.', '#a00');
            } else {
              clearStatus();
            }
            lastShiftTime = now;
          }
    
          // Stall check: if shifting into 1st gear without clutch and speed 0
          if (newGear === '1' && !clutchPressed && speed < 0.5 && engineRunning) {
            stallEngine();
          }
    
          currentGear = newGear;
          updateGearLabels();
          updateStickPosition();
          gearDisplay.textContent = currentGear === 'N' ? 'Neutral' : currentGear;
        }
      });
      window.addEventListener('mousemove', e => {
        if (!dragging) return;
        const rect = stickShift.getBoundingClientRect();
        let x = e.clientX - rect.left;
        let y = e.clientY - rect.top;
    
        // Clamp x,y inside stickShift circle area (approx 0-120)
        x = Math.min(Math.max(x, 0), 120);
        y = Math.min(Math.max(y, 0), 120);
    
        // Move knob
        stickKnob.style.left = (x - 15) + 'px';
        stickKnob.style.top = (y - 15) + 'px';
      });
    
      // Main simulation loop
      function simulate() {
        if (!engineRunning) {
          rpm = 0;
          speed = 0;
          updateDisplays();
          requestAnimationFrame(simulate);
          return;
        }
    
        // RPM logic
        if (gasPressed && clutchPressed === false && currentGear !== 'N') {
          // Increase RPM with gas if clutch not pressed and gear engaged
          rpm += rpmIncreaseRate;
        } else if (gasPressed && clutchPressed) {
          // Clutch pressed, engine revs freely
          rpm += rpmIncreaseRate * 1.5;
        } else {
          // No gas, RPM drops
          rpm -= rpmDecreaseRate;
        }
    
        // Clamp RPM
        if (rpm < idleRPM) rpm = idleRPM;
        if (rpm > maxRPM) {
          rpm = maxRPM;
          damageEngine();
        }
    
        // Speed logic
        if (currentGear === 'N' || clutchPressed) {
          // No power to wheels, speed decreases naturally or by brake
          if (brakePressed) {
            speed -= brakeRate;
          } else {
            speed -= decelerationRate;
          }
        } else {
          // Power to wheels
          if (gasPressed) {
            speed += accelerationRate;
          } else {
            // Natural deceleration
            if (brakePressed) {
              speed -= brakeRate;
            } else {
              speed -= decelerationRate;
            }
          }
          // Limit speed by gear max speed
          const maxSpeed = maxSpeedPerGear[currentGear] || 0;
          if (speed > maxSpeed) speed = maxSpeed;
        }
    
        if (speed < 0) speed = 0;
    
        // Stall check: if speed 0, gear engaged, gas pressed, clutch not pressed => stall
        if (speed < 0.5 && currentGear !== 'N' && gasPressed && !clutchPressed && engineRunning) {
          stallEngine();
        }
    
        // Update displays
        updateDisplays();
    
        // Update pedal visuals (in case keys changed)
        updatePedalVisuals();
    
        requestAnimationFrame(simulate);
      }
    
      // Initialize
      updateStickPosition();
      updateGearLabels();
      updateDisplays();
      setStatus('Use Q (clutch), W (gas), S (brake). Drag stick to shift gears.', '#0ff');
    
      simulate();
    })();
    </script>
    </body>
    </html>
    

    How to use:

    1. Open this file in a modern browser.
    2. Drag the round knob inside the stick shift circle to change gears.
    3. Hold Q to press the clutch.
    4. Hold W to press the gas pedal.
    5. Hold S to press the brake pedal.
    6. Try to start moving in 1st gear without clutch to stall.
    7. Shift without clutch or shift too fast at high RPM to damage gears.
    8. RPM will increase with gas and decrease without.
    9. Redline at 7000 RPM damages the engine and ends the simulation.

    If you want me to add more features or polish the UI, just ask!

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

Identical first prompt