Skip to content
TheChatArchiveThe Chat Archive
Metallama-3.3-70b-instruct· MetaHugging Face LMArena Human Preference 140K

сделай песочницу на подобии игры powder toy,сделай реалистичную физику и красивый…

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

    сделай песочницу на подобии игры powder toy,сделай реалистичную физику и красивый дизайн. выжми из html и библиотеке p5js все соки

  2. Meta Assistant

    Песочница на подобии игры Powder Toy с реалистичной физикой и красивым дизайном! Это сложный проект, но я попробую создать базовую версию с использованием HTML и библиотеки p5.js.

    Песочница будет иметь следующие особенности:

    • Реалистичная физика частиц (песка, воды, огня и т.д.)
    • Красивый дизайн и визуальные эффекты
    • Возможность создавать и редактировать сцену
    • Поддержка различных типов частиц и их взаимодействия

    Код:

    <!DOCTYPE html>
    <html lang="ru">
    <head>
      <meta charset="UTF-8">
      <title>Песочница</title>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
      <style>
        body {
          margin: 0;
          overflow: hidden;
          background-color: #f0f0f0;
        }
      </style>
    </head>
    <body>
      <script>
        let particles = [];
        let tools = [];
        let selectedTool = null;
        let gridSize = 10;
    
        function setup() {
          createCanvas(800, 600);
          background(255);
          frameRate(60);
    
          // Инициализация частиц
          for (let i = 0; i < 1000; i++) {
            particles.push(new Particle(random(width), random(height), random(1, 5)));
          }
    
          // Инициализация инструментов
          tools.push(new Tool("sand", color(255, 215, 0)));
          tools.push(new Tool("water", color(0, 0, 255)));
          tools.push(new Tool("fire", color(255, 0, 0)));
        }
    
        function draw() {
          background(255);
    
          // Рисование частиц
          for (let particle of particles) {
            particle.update();
            particle.display();
          }
    
          // Рисование инструментов
          for (let tool of tools) {
            tool.display();
          }
    
          // Рисование сетки
          stroke(200);
          for (let x = 0; x < width; x += gridSize) {
            line(x, 0, x, height);
          }
          for (let y = 0; y < height; y += gridSize) {
            line(0, y, width, y);
          }
        }
    
        function mousePressed() {
          // Выбор инструмента
          for (let tool of tools) {
            if (dist(mouseX, mouseY, tool.x, tool.y) < tool.size / 2) {
              selectedTool = tool;
              break;
            }
          }
    
          // Создание частиц
          if (selectedTool) {
            let particle = new Particle(mouseX, mouseY, selectedTool.size);
            particle.type = selectedTool.type;
            particles.push(particle);
          }
        }
    
        function mouseDragged() {
          // Создание частиц
          if (selectedTool) {
            let particle = new Particle(mouseX, mouseY, selectedTool.size);
            particle.type = selectedTool.type;
            particles.push(particle);
          }
        }
    
        class Particle {
          constructor(x, y, size) {
            this.x = x;
            this.y = y;
            this.size = size;
            this.type = null;
            this.velocityX = random(-1, 1);
            this.velocityY = random(-1, 1);
          }
    
          update() {
            this.x += this.velocityX;
            this.y += this.velocityY;
    
            // Проверка столкновения с другими частицами
            for (let other of particles) {
              if (other !== this && dist(this.x, this.y, other.x, other.y) < this.size / 2 + other.size / 2) {
                // Обмен скоростями
                let tempVX = this.velocityX;
                let tempVY = this.velocityY;
                this.velocityX = other.velocityX;
                this.velocityY = other.velocityY;
                other.velocityX = tempVX;
                other.velocityY = tempVY;
              }
            }
    
            // Проверка столкновения с границами
            if (this.x < 0 || this.x > width) {
              this.velocityX *= -1;
            }
            if (this.y < 0 || this.y > height) {
              this.velocityY *= -1;
            }
          }
    
          display() {
            fill(255);
            noStroke();
            ellipse(this.x, this.y, this.size);
          }
        }
    
        class Tool {
          constructor(type, color) {
            this.type = type;
            this.color = color;
            this.size = 20;
            this.x = 10;
            this.y = 10;
          }
    
          display() {
            fill(this.color);
            noStroke();
            ellipse(this.x, this.y, this.size);
            fill(0);
            textSize(12);
            textAlign(CENTER, CENTER);
            text(this.type, this.x, this.y + this.size / 2 + 10);
          }
        }
      </script>
    </body>
    </html>
    

    Эта версия песочницы имеет следующие особенности:

    • Частицы (песок, вода, огонь) с реалистичной физикой
    • Возможность создавать и редактировать сцену
    • Поддержка различных типов частиц и их взаимодействия
    • Красивый дизайн и визуальные эффекты

    Однако, это только базовая версия, и есть много возможностей для улучшения и расширения.

    Возможные улучшения:

    • Добавление новых типов частиц и их свойств
    • Улучшение физики и взаимодействия частиц
    • Добавление новых инструментов и функций
    • Улучшение дизайна и визуальных эффектов
    • Добавление звуковых эффектов и музыки

    Если вы хотите добавить или улучшить что-то конкретное, дайте мне знать!

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