Skip to content
TheChatArchiveThe Chat Archive
Googlegemma-3n-e4b-it· GoogleHugging Face LMArena Human Preference 140K

The graph should not be just circular.

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

    The graph should not be just circular.

  2. Google Assistant

    You're right to point that out! A purely circular graph might not be the most visually interesting or informative way to connect the cubes on a sphere. Let's modify the code to create a more natural-looking graph that follows the curvature of the sphere.

    Here's the updated code with a more organic graph structure:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Three.js Icosahedral Sphere with Cubes and Organic Graph</title>
        <style>
            body { margin: 0; }
            canvas { display: block; }
        </style>
    </head>
    <body>
        <!-- Import Three.js from a CDN -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
        <!-- Import OrbitControls for easy camera movement -->
        <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
        <!-- Import BufferGeometryUtils to ensure geometry has indices -->
        <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/utils/BufferGeometryUtils.js"></script>
    
        <script>
            // --- 1. Scene Setup ---
            let scene, camera, renderer, icoSphere, controls, group;
    
            function init() {
                // Create the scene
                scene = new THREE.Scene();
                scene.background = new THREE.Color(0x333333);
    
                // Create the camera
                camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
                camera.position.z = 5;
    
                // Create the renderer
                renderer = new THREE.WebGLRenderer({ antialias: true });
                renderer.setSize(window.innerWidth, window.innerHeight);
                document.body.appendChild(renderer.domElement);
    
                // Add OrbitControls
                controls = new THREE.OrbitControls(camera, renderer.domElement);
                controls.enableDamping = true; // smooth camera movement
    
                // Group to hold sphere, cubes, and lines (for collective rotation)
                group = new THREE.Group();
                scene.add(group);
    
                // --- 2. Create the Icosahedral Sphere ---
    
                const radius = 2;
                const detail = 3; // Higher = smoother sphere
    
                let geometry = new THREE.IcosahedronGeometry(radius, detail);
                geometry = THREE.BufferGeometryUtils.mergeVertices(geometry); // Ensures index exists
    
                // Material with flatShading and wireframe to show triangles
                const material = new THREE.MeshStandardMaterial({
                    color: 0x1E90FF, // Dodger Blue
                    flatShading: true,
                    wireframe: true // Comment out to hide wireframe
                });
    
                icoSphere = new THREE.Mesh(geometry, material);
                group.add(icoSphere);
    
                // --- 3. Place Small Cubes on Random Triangles ---
    
                const numCubes = 20; // Number of random cubes
                const cubeSize = 0.1;
                const cubeMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); // Red cubes
    
                // Get geometry data
                const positionAttr = geometry.attributes.position;
    
                let vertices = [];
                if (geometry.index) {
                    // Indexed geometry
                    const index = geometry.index;
                    for (let i = 0; i < index.count; i += 3) {
                        const a = index.getX(i);
                        const b = index.getY(i + 1);
                        const c = index.getZ(i + 2);
    
                        const v1 = new THREE.Vector3().fromBufferAttribute(positionAttr, a);
                        const v2 = new THREE.Vector3().fromBufferAttribute(positionAttr, b);
                        const v3 = new THREE.Vector3().fromBufferAttribute(positionAttr, c);
    
                        vertices.push([v1, v2, v3]);
                    }
                } else {
                    // Non-indexed geometry
                    for (let i = 0; i < positionAttr.count; i += 3) {
                        const v1 = new THREE.Vector3().fromBufferAttribute(positionAttr, i);
                        const v2 = new THREE.Vector3().fromBufferAttribute(positionAttr, i + 1);
                        const v3 = new THREE.Vector3().fromBufferAttribute(positionAttr, i + 2);
    
                        vertices.push([v1, v2, v3]);
                    }
                }
    
                const cubePositions = []; // Store positions for connecting later
    
                const numFaces = vertices.length;
    
                const selectedFaces = new Set();
                while (selectedFaces.size < numCubes) {
                    selectedFaces.add(Math.floor(Math.random() * numFaces));
                }
    
                selectedFaces.forEach(faceIndex => {
                    const [v1, v2, v3] = vertices[faceIndex];
    
                    // Compute centroid
                    const centroid = v1.clone().add(v2).add(v3).divideScalar(3);
    
                    // Normalize and scale to surface
                    const normal = centroid.clone().normalize();
                    const posOnSphere = normal.clone().multiplyScalar(radius);
    
                    // Create cube
                    const cubeGeo = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize);
                    const cube = new THREE.Mesh(cubeGeo, cubeMaterial);
                    cube.position.copy(posOnSphere);
    
                    // Orient cube to face outward
                    cube.lookAt(posOnSphere.clone().multiplyScalar(2)); // Point away from origin
    
                    // Shift slightly outward
                    cube.position.add(normal.clone().multiplyScalar(cubeSize / 2));
    
                    group.add(cube);
    
                    // Store adjusted position for connections
                    cubePositions.push(cube.position.clone());
                });
    
                // --- 4. Connect Cubes with Lines (Organic Graph) ---
    
                const numCubes = group.children.length;
                const connections = [];
    
                for (let i = 0; i < numCubes; i++) {
                    for (let j = i + 1; j < numCubes; j++) {
                        const cube1 = group.children[i];
                        const cube2 = group.children[j];
    
                        // Calculate the vector between the centers of the two cubes
                        const vector = cube2.position.clone().sub(cube1.position);
                        const distance = vector.length();
    
                        // If the distance is within a certain range, consider them connected
                        if (distance < 1.5) {
                            connections.push([i, j, distance]);
                        }
                    }
                }
    
                // Sort connections by distance
                connections.sort((a, b) => a[2] - b[2]);
    
                // Create lines for each connection
                const lineGeo = new THREE.BufferGeometry().setFromPoints([]);
                const lineMat = new THREE.LineBasicMaterial({ color: 0xffff00 });
                const graphLine = new THREE.LineLoop(lineGeo, lineMat);
                group.add(graphLine);
    
                connections.forEach(connection => {
                    const index1 = connection[0];
                    const index2 = connection[1];
                    const distance = connection[2];
    
                    const pos1 = group.children[index1].position.clone();
                    const pos2 = group.children[index2].position.clone();
    
                    const linePoints = [];
                    const numSegments = Math.floor(distance * 5); // Adjust for line segment count
                    for (let i = 0; i <= numSegments; i++) {
                        const t = i / numSegments;
                        const point = new THREE.Vector3().lerp(pos1, pos2, t);
                        linePoints.push(point);
                    }
    
                    const lineGeometry = new THREE.BufferGeometry().setFromPoints(linePoints);
                    const lineMaterial = new THREE.LineBasicMaterial({ color: 0xffff00 });
                    const line = new THREE.Line(lineGeometry, lineMaterial);
                    group.add(line);
                });
    
                // --- 5. Lighting ---
    
                const ambientLight = new THREE.AmbientLight(0x404040, 1.5);
                scene.add(ambientLight);
    
                const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
                directionalLight.position.set(5, 5, 5);
                scene.add(directionalLight);
    
                // Handle window resizing
                window.addEventListener('resize', onWindowResize, false);
            }
    

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