Skip to content
The Chat Archive
Qwenqwen3-235b-a22b· Alibaba (Qwen) LMArena Human Preference 140K

Make a web game similar to cookie clicker.

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.0-flash-001’s answer.
  1. User

    Make a web game similar to cookie clicker.

  2. Assistant

    Here's a web game similar to Cookie Clicker implemented in a single HTML file. It includes:

    • A clickable cookie that adds cookies manually.
    • Passive income via upgrades (CPS - Cookies Per Second).
    • A dynamic upgrade shop with escalating costs.
    • A responsive design with basic styling.

    ✅ Features

    • Click to Earn: Click the 🍪 emoji to earn 1 cookie per click.
    • Passive Income: Buy upgrades that generate cookies automatically.
    • Upgrade System: Each upgrade increases your CPS. The cost increases by 15% per purchase.
    • Real-Time Updates: CPS updates every 100ms to simulate real-time cookie accumulation.

    🧩 Technologies Used

    • HTML: Structure
    • CSS: Styling
    • JavaScript: Game logic, state management, and DOM updates

    📄 Full Code (Single HTML File)

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Cookie Clicker Clone</title>
      <style>
        body {
          font-family: Arial, sans-serif;
          text-align: center;
          background-color: #f8f0e3;
          margin: 0;
          padding: 0;
        }
        #cookie {
          font-size: 100px;
          width: 200px;
          height: 200px;
          line-height: 200px;
          text-align: center;
          margin: 50px auto;
          cursor: pointer;
          transition: transform 0.1s;
          user-select: none;
        }
        #cookie:active {
          transform: scale(0.95);
        }
        #score {
          font-size: 24px;
          margin-bottom: 20px;
        }
        #upgrades {
          display: flex;
          flex-wrap: wrap;
          justify-content: center;
          gap: 20px;
          padding: 0 20px;
        }
        .upgrade {
          background-color: #fff3dc;
          border: 2px solid #ccc;
          border-radius: 10px;
          padding: 10px;
          width: 150px;
          box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
        }
        .buy-btn {
          margin-top: 10px;
          padding: 5px 10px;
          font-size: 14px;
          cursor: pointer;
        }
      </style>
    </head>
    <body>
      <div id="game">
        <div id="cookie">🍪</div>
        <p id="score">Cookies: 0</p>
        <div id="upgrades"></div>
      </div>
    
      <script>
        let cookies = 0;
        let totalCps = 0;
    
        const upgrades = [
          {
            name: 'Cursor',
            cost: 15,
            baseCost: 15,
            cps: 0.1,
            owned: 0
          },
          {
            name: 'Grandma',
            cost: 100,
            baseCost: 100,
            cps: 1,
            owned: 0
          },
          {
            name: 'Farm',
            cost: 1100,
            baseCost: 1100,
            cps: 8,
            owned: 0
          }
        ];
    
        function buyUpgrade(upgrade) {
          if (cookies >= upgrade.cost) {
            cookies -= upgrade.cost;
            upgrade.owned += 1;
            totalCps += upgrade.cps;
            upgrade.cost *= 1.15;
            updateDisplay();
          }
        }
    
        function updateDisplay() {
          document.getElementById('score').textContent = `Cookies: ${Math.floor(cookies)}`;
          renderUpgrades();
        }
    
        function renderUpgrades() {
          const upgradesDiv = document.getElementById('upgrades');
          upgradesDiv.innerHTML = '';
          upgrades.forEach(upgrade => {
            const div = document.createElement('div');
            div.className = 'upgrade';
            div.innerHTML = `
              <strong>${upgrade.name}</strong><br>
              Cost: ${upgrade.cost.toFixed(1)}<br>
              Owned: ${upgrade.owned}<br>
              <button class="buy-btn">Buy</button>
            `;
            div.querySelector('.buy-btn').addEventListener('click', () => buyUpgrade(upgrade));
            upgradesDiv.appendChild(div);
          });
        }
    
        // Setup event listeners
        document.getElementById('cookie').addEventListener('click', () => {
          cookies += 1;
          updateDisplay();
        });
    
        setInterval(() => {
          cookies += totalCps * 0.1; // 10 times per second
          updateDisplay();
        }, 100);
    
        // Initial render
        updateDisplay();
      </script>
    </body>
    </html>
    

    🚀 How to Use

    1. Save the code above in a file named index.html.
    2. Open it in a browser.
    3. Click the 🍪 emoji to earn cookies manually.
    4. Buy upgrades to generate cookies automatically.
    5. Watch your CPS grow and enjoy the incremental fun!

    🛠️ Possible Enhancements

    • Add CPC (Cookies Per Click) upgrades.
    • Implement auto-saving using localStorage.
    • Add animations or sound effects for clicks and purchases.
    • Add more upgrades with unique effects.
    • Create a progress bar or achievements system.

    Let me know if you'd like help adding any of these!

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