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

Recreate a pokemon battle ui. Make it interactive

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o3-2025-04-16’s answer.
  1. User

    Recreate a pokemon battle ui. Make it interactive

  2. Assistant

    Creating an interactive Pokémon battle UI involves a combination of HTML, CSS, and JavaScript. Below is a simple example that mimics a classic Pokémon battle screen with basic interactivity. You can expand it with more features like animations, health bars, and multiple moves.


    Features:

    • Displays two Pokémon with their names and HP bars.
    • Four move buttons for the player.
    • Clicking a move triggers a simple attack animation and updates HP.
    • Basic turn-based logic (player attacks, then opponent attacks).

    How to use:

    • Copy the code below into an index.html file.
    • Open it in a browser.
    • Click the moves to attack the opponent.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Pokémon Battle UI</title>
    <style>
      body {
        font-family: 'Arial', sans-serif;
        background: #7ec0ee;
        margin: 0;
        padding: 20px;
        display: flex;
        justify-content: center;
      }
      #battle-container {
        width: 600px;
        background: #f0f0f0;
        border: 4px solid #333;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 0 15px #222;
      }
      .pokemon {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
      }
      .pokemon .info {
        width: 200px;
      }
      .pokemon .info h2 {
        margin: 0 0 5px 0;
      }
      .hp-bar {
        width: 100%;
        height: 20px;
        background: #ddd;
        border: 1px solid #999;
        border-radius: 10px;
        overflow: hidden;
      }
      .hp-fill {
        height: 100%;
        background: #4caf50;
        width: 100%;
        transition: width 0.5s ease;
      }
      .pokemon img {
        width: 120px;
        height: 120px;
        image-rendering: pixelated;
      }
      #message-box {
        background: #222;
        color: #fff;
        padding: 10px;
        height: 60px;
        border-radius: 8px;
        margin-bottom: 20px;
        font-weight: bold;
      }
      #moves {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
      }
      button.move-btn {
        background: #eee;
        border: 2px solid #333;
        border-radius: 8px;
        padding: 10px;
        font-weight: bold;
        cursor: pointer;
        transition: background 0.3s;
      }
      button.move-btn:hover:not(:disabled) {
        background: #cceeff;
      }
      button.move-btn:disabled {
        background: #aaa;
        cursor: not-allowed;
      }
    </style>
    </head>
    <body>
    
    <div id="battle-container">
      <div class="pokemon" id="opponent">
        <div class="info">
          <h2 id="opponent-name">Charmander</h2>
          <div class="hp-bar">
            <div class="hp-fill" id="opponent-hp" style="width: 100%;"></div>
          </div>
        </div>
        <img src="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/4.png" alt="Charmander" />
      </div>
    
      <div class="pokemon" id="player">
        <img src="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/25.png" alt="Pikachu" />
        <div class="info">
          <h2 id="player-name">Pikachu</h2>
          <div class="hp-bar">
            <div class="hp-fill" id="player-hp" style="width: 100%;"></div>
          </div>
        </div>
      </div>
    
      <div id="message-box">What will Pikachu do?</div>
    
      <div id="moves">
        <button class="move-btn" data-move="Thunder Shock">Thunder Shock</button>
        <button class="move-btn" data-move="Quick Attack">Quick Attack</button>
        <button class="move-btn" data-move="Tail Whip">Tail Whip</button>
        <button class="move-btn" data-move="Growl">Growl</button>
      </div>
    </div>
    
    <script>
      const player = {
        name: "Pikachu",
        maxHp: 100,
        currentHp: 100,
        moves: {
          "Thunder Shock": { damage: 20, type: "attack" },
          "Quick Attack": { damage: 15, type: "attack" },
          "Tail Whip": { damage: 0, type: "debuff" },
          "Growl": { damage: 0, type: "debuff" }
        }
      };
    
      const opponent = {
        name: "Charmander",
        maxHp: 100,
        currentHp: 100,
        moves: [
          { name: "Scratch", damage: 10 },
          { name: "Ember", damage: 18 }
        ]
      };
    
      const messageBox = document.getElementById("message-box");
      const playerHpBar = document.getElementById("player-hp");
      const opponentHpBar = document.getElementById("opponent-hp");
      const moveButtons = document.querySelectorAll(".move-btn");
    
      function updateHpBars() {
        playerHpBar.style.width = (player.currentHp / player.maxHp) * 100 + "%";
        opponentHpBar.style.width = (opponent.currentHp / opponent.maxHp) * 100 + "%";
    
        if (player.currentHp <= 0) {
          messageBox.textContent = `${player.name} fainted! You lost!`;
          disableMoves();
        } else if (opponent.currentHp <= 0) {
          messageBox.textContent = `${opponent.name} fainted! You won!`;
          disableMoves();
        }
      }
    
      function disableMoves() {
        moveButtons.forEach(btn => btn.disabled = true);
      }
    
      function enableMoves() {
        moveButtons.forEach(btn => btn.disabled = false);
      }
    
      function opponentAttack() {
        disableMoves();
        const move = opponent.moves[Math.floor(Math.random() * opponent.moves.length)];
        messageBox.textContent = `${opponent.name} used ${move.name}!`;
    
        setTimeout(() => {
          player.currentHp -= move.damage;
          if (player.currentHp < 0) player.currentHp = 0;
          updateHpBars();
    
          if (player.currentHp > 0) {
            messageBox.textContent = `What will ${player.name} do?`;
            enableMoves();
          }
        }, 1500);
      }
    
      function playerAttack(moveName) {
        disableMoves();
        const move = player.moves[moveName];
        if (move.type === "attack") {
          messageBox.textContent = `${player.name} used ${moveName}!`;
          setTimeout(() => {
            opponent.currentHp -= move.damage;
            if (opponent.currentHp < 0) opponent.currentHp = 0;
            updateHpBars();
    
            if (opponent.currentHp > 0) {
              setTimeout(() => {
                opponentAttack();
              }, 1000);
            }
          }, 1000);
        } else {
          // For debuff moves, just show message and opponent attacks next turn
          messageBox.textContent = `${player.name} used ${moveName}! But it had no effect.`;
          setTimeout(() => {
            opponentAttack();
          }, 1500);
        }
      }
    
      moveButtons.forEach(button => {
        button.addEventListener("click", () => {
          if (button.disabled) return;
          playerAttack(button.dataset.move);
        });
      });
    
      updateHpBars();
    </script>
    
    </body>
    </html>
    

    Explanation:

    • The UI shows two Pokémon with HP bars.
    • Player can click moves to attack.
    • Opponent attacks automatically after player’s turn.
    • HP bars update smoothly.
    • Messages guide the player through the battle.

    If you want me to add animations, sound effects, or more complex battle mechanics, just ask!

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