Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-search-preview-high-loc· OpenAIHugging Face LMArena Search Arena 24K

Please program a simple clone of the core functions of cstimer.net in a single html file

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Perplexitysonar-reasoning-pro-high’s answer.
  1. User

    Please program a simple clone of the core functions of cstimer.net in a single html file

  2. Assistant

    Certainly! Here's a simple HTML file that replicates the core functionality of cstimer.net, including a timer, scramble generator, and session management. This implementation uses HTML, CSS, and JavaScript to provide a basic speedcubing timer experience.

    <!DOCTYPE html>
    
    <html lang="en">
    <head>
    <meta charset="utf-8"/>
    <title>Speedcubing Timer</title>
    <style>
        body {
          font-family: Arial, sans-serif;
          text-align: center;
          margin: 0;
          padding: 0;
        }
        #timer {
          font-size: 5em;
          margin: 20px 0;
        }
        #scramble {
          font-size: 1.5em;
          margin: 20px 0;
        }
        #session {
          margin-top: 20px;
        }
        #session-list {
          list-style-type: none;
          padding: 0;
        }
        #session-list li {
          margin: 5px 0;
        }
      </style>
    </head>
    <body>
    <h1>Speedcubing Timer</h1>
    <div id="scramble">Scramble: </div>
    <div id="timer">0.000</div>
    <button id="start-stop">Start/Stop</button>
    <button id="reset">Reset</button>
    <button id="new-scramble">New Scramble</button>
    <div id="session">
    <h2>Session Times</h2>
    <ul id="session-list"></ul>
    </div>
    <script>
        let timerInterval;
        let startTime;
        let running = false;
        let sessionTimes = [];
    
        const timerDisplay = document.getElementById('timer');
        const scrambleDisplay = document.getElementById('scramble');
        const sessionList = document.getElementById('session-list');
    
        function generateScramble() {
          const moves = ["R", "L", "U", "D", "F", "B"];
          const modifiers = ["", "'", "2"];
          let scramble = [];
          let lastMove = "";
    
          for (let i = 0; i < 20; i++) {
            let move;
            do {
              move = moves[Math.floor(Math.random() * moves.length)];
            } while (move === lastMove);
            lastMove = move;
            const modifier = modifiers[Math.floor(Math.random() * modifiers.length)];
            scramble.push(move + modifier);
          }
    
          return scramble.join(" ");
        }
    
        function updateScramble() {
          scrambleDisplay.textContent = "Scramble: " + generateScramble();
        }
    
        function startTimer() {
          startTime = Date.now();
          timerInterval = setInterval(() => {
            const elapsedTime = (Date.now() - startTime) / 1000;
            timerDisplay.textContent = elapsedTime.toFixed(3);
          }, 10);
          running = true;
        }
    
        function stopTimer() {
          clearInterval(timerInterval);
          const finalTime = parseFloat(timerDisplay.textContent);
          sessionTimes.push(finalTime);
          updateSession();
          running = false;
        }
    
        function resetTimer() {
          clearInterval(timerInterval);
          timerDisplay.textContent = "0.000";
          running = false;
        }
    
        function updateSession() {
          sessionList.innerHTML = "";
          sessionTimes.forEach((time, index) => {
            const listItem = document.createElement('li');
            listItem.textContent = `Solve ${index + 1}: ${time.toFixed(3)} seconds`;
            sessionList.appendChild(listItem);
          });
        }
    
        document.getElementById('start-stop').addEventListener('click', () => {
          if (running) {
            stopTimer();
          } else {
            startTimer();
          }
        });
    
        document.getElementById('reset').addEventListener('click', resetTimer);
        document.getElementById('new-scramble').addEventListener('click', updateScramble);
    
        // Initialize with a scramble
        updateScramble();
      </script>
    </body>
    </html>
    

    Features:

    • Scramble Generator: Generates a random 20-move scramble using standard cube notation.
    • Timer: Starts and stops with a button click, displaying time in seconds with millisecond precision.
    • Session Management: Records each solve time and displays them in a list.

    Usage:

    1. Open the HTML file in a web browser.
    2. Click "Start/Stop" to begin or end the timer.
    3. Click "Reset" to reset the timer to zero.
    4. Click "New Scramble" to generate a new scramble sequence.

    This simple implementation provides the core functionalities of cstimer.net in a single HTML file.

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