Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Neural Net Nurture - Enhanced</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- position: relative;
- color: white;
- }
- .container {
- width: 90%;
- max-width: 1200px;
- background: rgba(255, 255, 255, 0.1);
- backdrop-filter: blur(10px);
- border-radius: 30px;
- padding: 40px;
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
- position: relative;
- z-index: 10;
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- .header {
- text-align: center;
- margin-bottom: 30px;
- }
- h1 {
- color: #64ffda;
- font-size: 2.5em;
- margin-bottom: 10px;
- text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
- }
- .pet-name {
- font-size: 1.5em;
- color: #64ffda;
- margin-bottom: 20px;
- font-weight: bold;
- text-shadow: 0 0 5px rgba(100, 255, 218, 0.5);
- }
- .level-display {
- font-size: 1.2em;
- margin-bottom: 10px;
- color: #ff79c6;
- }
- .stats-container {
- display: flex;
- justify-content: space-around;
- margin-bottom: 30px;
- flex-wrap: wrap;
- }
- .stat {
- text-align: center;
- padding: 15px;
- background: rgba(100, 255, 218, 0.1);
- border-radius: 15px;
- color: white;
- min-width: 120px;
- margin: 5px;
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .stat-label {
- font-size: 0.9em;
- opacity: 0.9;
- margin-bottom: 5px;
- color: #64ffda;
- }
- .stat-value {
- font-size: 1.5em;
- font-weight: bold;
- }
- .neural-network {
- position: relative;
- height: 400px;
- margin: 30px 0;
- background: radial-gradient(ellipse at center, rgba(100, 255, 218, 0.1) 0%, transparent 70%);
- border-radius: 20px;
- overflow: visible;
- border: 1px solid rgba(100, 255, 218, 0.2);
- }
- .neuron {
- position: absolute;
- width: 40px;
- height: 40px;
- background: radial-gradient(circle, #64ffda, #2979ff);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #0a192f;
- font-weight: bold;
- box-shadow: 0 0 20px rgba(100, 255, 218, 0.5);
- animation: pulse 2s ease-in-out infinite;
- transition: all 0.3s ease;
- cursor: pointer;
- z-index: 5;
- }
- .neuron:hover {
- transform: scale(1.2);
- box-shadow: 0 0 30px rgba(100, 255, 218, 0.8);
- }
- .neuron.active {
- animation: activePulse 0.5s ease-in-out;
- box-shadow: 0 0 40px rgba(255, 255, 255, 0.9);
- }
- @keyframes pulse {
- 0%, 100% { transform: scale(1); opacity: 0.9; }
- 50% { transform: scale(1.1); opacity: 1; }
- }
- @keyframes activePulse {
- 0% { transform: scale(1); }
- 50% { transform: scale(1.5); }
- 100% { transform: scale(1); }
- }
- .synapse {
- position: absolute;
- height: 2px;
- background: linear-gradient(90deg, transparent, rgba(100, 255, 218, 0.6), transparent);
- transform-origin: left center;
- animation: synapseFlow 3s ease-in-out infinite;
- pointer-events: none;
- z-index: 1;
- }
- @keyframes synapseFlow {
- 0% { opacity: 0.3; }
- 50% { opacity: 1; }
- 100% { opacity: 0.3; }
- }
- .thought-bubble {
- position: absolute;
- top: -60px;
- left: 50%;
- transform: translateX(-50%);
- background: rgba(10, 25, 47, 0.9);
- padding: 15px 20px;
- border-radius: 20px;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
- font-size: 14px;
- color: #64ffda;
- opacity: 0;
- transition: opacity 0.3s ease;
- z-index: 20;
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .thought-bubble.show {
- opacity: 1;
- }
- .thought-bubble:after {
- content: '';
- position: absolute;
- bottom: -10px;
- left: 50%;
- transform: translateX(-50%);
- width: 0;
- height: 0;
- border-left: 10px solid transparent;
- border-right: 10px solid transparent;
- border-top: 10px solid rgba(10, 25, 47, 0.9);
- }
- .controls {
- display: flex;
- justify-content: center;
- gap: 15px;
- flex-wrap: wrap;
- margin-top: 30px;
- }
- .btn {
- padding: 12px 25px;
- border: none;
- border-radius: 25px;
- font-size: 16px;
- font-weight: bold;
- cursor: pointer;
- transition: all 0.3s ease;
- color: white;
- position: relative;
- overflow: hidden;
- background: rgba(100, 255, 218, 0.2);
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .btn:before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- width: 0;
- height: 0;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.1);
- transform: translate(-50%, -50%);
- transition: width 0.6s, height 0.6s;
- }
- .btn:hover:before {
- width: 300px;
- height: 300px;
- }
- .btn-feed {
- background: linear-gradient(135deg, rgba(79, 172, 254, 0.3), rgba(0, 242, 254, 0.3));
- }
- .btn-train {
- background: linear-gradient(135deg, rgba(67, 233, 123, 0.3), rgba(56, 249, 215, 0.3));
- }
- .btn-scold {
- background: linear-gradient(135deg, rgba(250, 112, 154, 0.3), rgba(254, 225, 64, 0.3));
- }
- .btn-puzzle {
- background: linear-gradient(135deg, rgba(48, 207, 208, 0.3), rgba(51, 8, 103, 0.3));
- }
- .modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.7);
- z-index: 100;
- align-items: center;
- justify-content: center;
- }
- .modal.show {
- display: flex;
- }
- .modal-content {
- background: rgba(10, 25, 47, 0.95);
- padding: 30px;
- border-radius: 20px;
- max-width: 500px;
- width: 90%;
- text-align: center;
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .modal h2 {
- color: #64ffda;
- margin-bottom: 20px;
- }
- .dataset-option, .puzzle-option {
- padding: 10px 20px;
- margin: 10px;
- border: 2px solid rgba(100, 255, 218, 0.5);
- border-radius: 15px;
- cursor: pointer;
- transition: all 0.3s ease;
- display: inline-block;
- background: rgba(100, 255, 218, 0.1);
- }
- .dataset-option:hover, .puzzle-option:hover {
- background: rgba(100, 255, 218, 0.3);
- color: white;
- transform: scale(1.05);
- }
- .close-modal {
- margin-top: 20px;
- padding: 10px 20px;
- background: rgba(100, 255, 218, 0.2);
- color: white;
- border: none;
- border-radius: 15px;
- cursor: pointer;
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .particle {
- position: absolute;
- width: 4px;
- height: 4px;
- background: rgba(100, 255, 218, 0.6);
- border-radius: 50%;
- pointer-events: none;
- animation: float 3s ease-in-out infinite;
- }
- @keyframes float {
- 0%, 100% { transform: translateY(0) translateX(0); opacity: 0; }
- 25% { opacity: 1; }
- 75% { opacity: 1; }
- 100% { transform: translateY(-100px) translateX(50px); }
- }
- .mood-indicator {
- text-align: center;
- font-size: 3em;
- margin: 20px 0;
- }
- .learning-progress-container {
- width: 100%;
- margin: 20px 0;
- position: relative;
- }
- .progress-header {
- display: flex;
- justify-content: space-between;
- margin-bottom: 5px;
- font-size: 0.9em;
- color: #64ffda;
- }
- .learning-progress {
- width: 100%;
- height: 25px;
- background: rgba(255, 255, 255, 0.1);
- border-radius: 12px;
- overflow: hidden;
- position: relative;
- border: 1px solid rgba(100, 255, 218, 0.3);
- }
- .progress-bar {
- height: 100%;
- background: linear-gradient(90deg, #64ffda, #2979ff);
- width: 0%;
- transition: width 0.5s ease;
- position: relative;
- overflow: hidden;
- }
- .progress-bar:after {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
- animation: shimmer 2s infinite;
- }
- @keyframes shimmer {
- 0% { transform: translateX(-100%); }
- 100% { transform: translateX(100%); }
- }
- .info-text {
- text-align: center;
- color: #64ffda;
- font-style: italic;
- margin: 10px 0;
- min-height: 24px;
- }
- .corruption-warning {
- color: #ff79c6;
- font-size: 0.8em;
- margin-top: 5px;
- text-align: center;
- }
- .evolution-modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.9);
- z-index: 200;
- align-items: center;
- justify-content: center;
- animation: fadeIn 0.5s ease;
- }
- .evolution-modal.show {
- display: flex;
- }
- .evolution-content {
- background: linear-gradient(135deg, #0f0c29, #302b63);
- padding: 40px;
- border-radius: 20px;
- max-width: 600px;
- width: 90%;
- text-align: center;
- border: 2px solid #64ffda;
- box-shadow: 0 0 30px rgba(100, 255, 218, 0.5);
- animation: scaleIn 0.5s ease;
- }
- @keyframes fadeIn {
- from { opacity: 0; }
- to { opacity: 1; }
- }
- @keyframes scaleIn {
- from { transform: scale(0.8); opacity: 0; }
- to { transform: scale(1); opacity: 1; }
- }
- .evolution-title {
- color: #64ffda;
- font-size: 2em;
- margin-bottom: 20px;
- text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
- }
- .new-name {
- font-size: 2.5em;
- color: #ff79c6;
- margin: 20px 0;
- text-shadow: 0 0 10px rgba(255, 121, 198, 0.5);
- animation: glow 2s infinite alternate;
- }
- @keyframes glow {
- from { text-shadow: 0 0 10px rgba(255, 121, 198, 0.5); }
- to { text-shadow: 0 0 20px rgba(255, 121, 198, 0.8), 0 0 30px rgba(255, 121, 198, 0.6); }
- }
- .evolution-message {
- font-size: 1.2em;
- margin-bottom: 30px;
- color: #64ffda;
- }
- .continue-btn {
- padding: 12px 30px;
- background: rgba(100, 255, 218, 0.2);
- color: white;
- border: 1px solid rgba(100, 255, 218, 0.5);
- border-radius: 25px;
- font-size: 16px;
- cursor: pointer;
- transition: all 0.3s ease;
- }
- .continue-btn:hover {
- background: rgba(100, 255, 218, 0.3);
- transform: scale(1.05);
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="header">
- <h1>🧠 Neural Net Nurture - Enhanced</h1>
- <div class="pet-name" id="petName">Baby Neuron</div>
- <div class="level-display">Level: <span id="level">1</span></div>
- </div>
- <div class="stats-container">
- <div class="stat">
- <div class="stat-label">Intelligence</div>
- <div class="stat-value" id="intelligence">100</div>
- </div>
- <div class="stat">
- <div class="stat-label">Accuracy</div>
- <div class="stat-value" id="accuracy">40%</div>
- </div>
- <div class="stat">
- <div class="stat-label">Happiness</div>
- <div class="stat-value" id="happiness">75</div>
- </div>
- <div class="stat">
- <div class="stat-label">Energy</div>
- <div class="stat-value" id="energy">100</div>
- </div>
- <div class="stat">
- <div class="stat-label">Age</div>
- <div class="stat-value" id="age">0d</div>
- </div>
- </div>
- <div class="mood-indicator" id="mood">😊</div>
- <div class="learning-progress-container">
- <div class="progress-header">
- <span>Learning Progress</span>
- <span id="progressPercent">0%</span>
- </div>
- <div class="learning-progress">
- <div class="progress-bar" id="progressBar"></div>
- </div>
- <div class="corruption-warning">⚠️ Progress decreases by 0.24% every second due to data corruption and cosmic radiation</div>
- </div>
- <div class="info-text" id="statusMessage">Your neural network is ready to learn!</div>
- <div class="neural-network" id="neuralNetwork">
- <div class="thought-bubble" id="thoughtBubble"></div>
- </div>
- <div class="controls">
- <button class="btn btn-feed" onclick="showFeedModal()">🍼 Feed Data</button>
- <button class="btn btn-train" onclick="trainNetwork()">🎯 Train</button>
- <button class="btn btn-scold" onclick="scoldNetwork()">⚠️ Scold Overfit</button>
- <button class="btn btn-puzzle" onclick="showPuzzleModal()">🧩 Solve Puzzle</button>
- </div>
- </div>
- <div class="modal" id="feedModal">
- <div class="modal-content">
- <h2>Choose Dataset to Feed</h2>
- <div class="dataset-option" onclick="feedData('clean')">🌟 Clean Data (Nutritious)</div>
- <div class="dataset-option" onclick="feedData('noisy')">🌪️ Noisy Data (Junk Food)</div>
- <div class="dataset-option" onclick="feedData('balanced')">⚖️ Balanced Data (Complete Meal)</div>
- <button class="close-modal" onclick="closeModal('feedModal')">Close</button>
- </div>
- </div>
- <div class="modal" id="puzzleModal">
- <div class="modal-content">
- <h2>Choose a Puzzle</h2>
- <div class="puzzle-option" onclick="solvePuzzle('pattern')">🎨 Pattern Recognition</div>
- <div class="puzzle-option" onclick="solvePuzzle('classification')">📊 Classification Task</div>
- <div class="puzzle-option" onclick="solvePuzzle('prediction')">🔮 Prediction Challenge</div>
- <button class="close-modal" onclick="closeModal('puzzleModal')">Close</button>
- </div>
- </div>
- <div class="evolution-modal" id="evolutionModal">
- <div class="evolution-content">
- <div class="evolution-title">🌟 Evolution Complete! 🌟</div>
- <div class="evolution-message">Your neural network has reached a new level of intelligence!</div>
- <div class="new-name" id="newName">New Name</div>
- <div class="evolution-message" id="evolutionMessage">It is evolving into a more advanced form.</div>
- <button class="continue-btn" onclick="closeEvolutionModal()">Continue Nurturing</button>
- </div>
- </div>
- <script>
- // Neural Network Pet State
- let petState = {
- intelligence: 100, // Starts at 100, can go over 9000
- accuracy: 40,
- happiness: 75,
- energy: 100,
- age: 0,
- experience: 0,
- level: 1,
- overfitRisk: 0,
- lastFed: Date.now(),
- neurons: [],
- synapses: [],
- feedHistory: [], // Track the order of feeding
- puzzleHistory: [], // Track puzzle performance
- trainingStyle: "balanced", // Tracks the nurturing style
- evolutionPath: [] // Tracks the evolution progression
- };
- // Complex evolution system with bases and adjectives
- const evolutionBases = [
- "Neuron", "Dendrite", "Synapse", "Axon", "Network",
- "Cortex", "Nucleus", "Matrix", "Web", "Grid"
- ];
- const evolutionAdjectives = [
- "Curious", "Pattern-Seeking", "Data-Hungry", "Abstract", "Logical",
- "Creative", "Analytical", "Intuitive", "Precise", "Adaptive",
- "Resilient", "Focused", "Expansive", "Deep", "Wide",
- "Layered", "Connected", "Parallel", "Recursive", "Generative",
- "Predictive", "Classifying", "Clustering", "Optimizing", "Learning",
- "Reasoning", "Deductive", "Inductive", "Transformative", "Emergent",
- "Conscious", "Self-Aware", "Metacognitive", "Philosophical", "Cosmic",
- "Quantum", "Multidimensional", "Temporal", "Spatial", "Universal"
- ];
- // Initialize the neural network visualization
- function initializeNetwork() {
- const network = document.getElementById('neuralNetwork');
- const layers = [3, 5, 4, 2]; // Network architecture
- const layerSpacing = network.clientWidth / (layers.length + 1);
- petState.neurons = [];
- petState.synapses = [];
- // Create neurons
- layers.forEach((nodeCount, layerIndex) => {
- const x = layerSpacing * (layerIndex + 1);
- const ySpacing = network.clientHeight / (nodeCount + 1);
- for (let i = 0; i < nodeCount; i++) {
- const y = ySpacing * (i + 1);
- const neuron = document.createElement('div');
- neuron.className = 'neuron';
- neuron.style.left = x - 20 + 'px';
- neuron.style.top = y - 20 + 'px';
- neuron.innerHTML = layerIndex === 0 ? 'I' : layerIndex === layers.length - 1 ? 'O' : 'H';
- neuron.dataset.layer = layerIndex;
- neuron.dataset.index = i;
- neuron.addEventListener('click', () => activateNeuron(neuron));
- network.appendChild(neuron);
- petState.neurons.push({element: neuron, x, y, layer: layerIndex, index: i});
- }
- });
- // Create synapses (connections)
- for (let l = 0; l < layers.length - 1; l++) {
- const currentLayer = petState.neurons.filter(n => n.layer === l);
- const nextLayer = petState.neurons.filter(n => n.layer === l + 1);
- currentLayer.forEach(neuron1 => {
- nextLayer.forEach(neuron2 => {
- if (Math.random() > 0.3) { // Not all connections for visual clarity
- const synapse = createSynapse(neuron1, neuron2);
- network.appendChild(synapse);
- petState.synapses.push(synapse);
- }
- });
- });
- }
- // Add floating particles for ambiance
- setInterval(createParticle, 2000);
- }
- function createSynapse(neuron1, neuron2) {
- const synapse = document.createElement('div');
- synapse.className = 'synapse';
- const dx = neuron2.x - neuron1.x;
- const dy = neuron2.y - neuron1.y;
- const length = Math.sqrt(dx * dx + dy * dy);
- const angle = Math.atan2(dy, dx) * 180 / Math.PI;
- synapse.style.width = length + 'px';
- synapse.style.left = neuron1.x + 'px';
- synapse.style.top = neuron1.y + 'px';
- synapse.style.transform = `rotate(${angle}deg)`;
- synapse.style.animationDelay = Math.random() * 3 + 's';
- return synapse;
- }
- function activateNeuron(neuron) {
- neuron.classList.add('active');
- setTimeout(() => neuron.classList.remove('active'), 500);
- // Propagate activation
- const layer = parseInt(neuron.dataset.layer);
- const nextLayerNeurons = petState.neurons.filter(n => n.layer === layer + 1);
- setTimeout(() => {
- nextLayerNeurons.forEach(n => {
- if (Math.random() > 0.5) {
- n.element.classList.add('active');
- setTimeout(() => n.element.classList.remove('active'), 500);
- }
- });
- }, 200);
- showThought("Signal propagating! 💫");
- }
- function createParticle() {
- const network = document.getElementById('neuralNetwork');
- const particle = document.createElement('div');
- particle.className = 'particle';
- particle.style.left = Math.random() * network.clientWidth + 'px';
- particle.style.top = network.clientHeight + 'px';
- particle.style.animationDelay = Math.random() * 2 + 's';
- network.appendChild(particle);
- setTimeout(() => particle.remove(), 3000);
- }
- function showThought(message) {
- const bubble = document.getElementById('thoughtBubble');
- bubble.textContent = message;
- bubble.classList.add('show');
- setTimeout(() => bubble.classList.remove('show'), 3000);
- }
- function updateStats() {
- document.getElementById('intelligence').textContent = Math.round(petState.intelligence);
- document.getElementById('accuracy').textContent = Math.round(petState.accuracy) + '%';
- document.getElementById('happiness').textContent = Math.round(petState.happiness);
- document.getElementById('energy').textContent = Math.round(petState.energy);
- document.getElementById('age').textContent = petState.age + 'd';
- document.getElementById('level').textContent = petState.level;
- // Update mood based on stats
- updateMood();
- // Update progress bar
- const progressPercent = Math.min(100, Math.max(0, petState.experience));
- document.getElementById('progressBar').style.width = progressPercent + '%';
- document.getElementById('progressPercent').textContent = progressPercent.toFixed(1) + '%';
- }
- function updateMood() {
- const mood = document.getElementById('mood');
- const avg = (petState.happiness + petState.energy) / 2;
- if (avg > 80) {
- mood.textContent = '😄';
- } else if (avg > 60) {
- mood.textContent = '😊';
- } else if (avg > 40) {
- mood.textContent = '😐';
- } else if (avg > 20) {
- mood.textContent = '😟';
- } else {
- mood.textContent = '😢';
- }
- }
- function showFeedModal() {
- document.getElementById('feedModal').classList.add('show');
- }
- function showPuzzleModal() {
- document.getElementById('puzzleModal').classList.add('show');
- }
- function closeModal(modalId) {
- document.getElementById(modalId).classList.remove('show');
- }
- function feedData(type) {
- closeModal('feedModal');
- let message, intelligenceChange, accuracyChange, happinessChange, overfitChange, expGain;
- // Track feeding history for evolution
- petState.feedHistory.push(type);
- if (petState.feedHistory.length > 10) {
- petState.feedHistory.shift();
- }
- // Determine feeding pattern for evolution
- updateTrainingStyle();
- switch(type) {
- case 'clean':
- message = "Yummy! Clean data is so nutritious! 🌟";
- intelligenceChange = 15;
- accuracyChange = 10;
- happinessChange = 10;
- overfitChange = -5;
- expGain = 20;
- break;
- case 'noisy':
- message = "Ugh... this data is messy! 🤢";
- intelligenceChange = -8;
- accuracyChange = -15;
- happinessChange = -15;
- overfitChange = 20;
- expGain = 5;
- break;
- case 'balanced':
- message = "Perfect balance! I'm learning so much! ⚖️";
- intelligenceChange = 25;
- accuracyChange = 15;
- happinessChange = 15;
- overfitChange = -10;
- expGain = 30;
- break;
- }
- petState.intelligence = Math.max(0, petState.intelligence + intelligenceChange);
- petState.accuracy = Math.min(100, Math.max(0, petState.accuracy + accuracyChange));
- petState.happiness = Math.min(100, Math.max(0, petState.happiness + happinessChange));
- petState.overfitRisk = Math.min(100, Math.max(0, petState.overfitRisk + overfitChange));
- petState.experience += expGain;
- showThought(message);
- updateStats();
- animateNetworkActivity();
- updateStatus(`Fed ${type} data to your neural network!`);
- // Check for level up
- checkLevelUp();
- }
- function trainNetwork() {
- if (petState.energy < 20) {
- showThought("Too tired to train... 😴");
- updateStatus("Your network needs rest!");
- return;
- }
- petState.energy = Math.max(0, petState.energy - 20);
- // Intelligence gain depends on current intelligence and training style
- let intelligenceGain = 5;
- if (petState.trainingStyle === "balanced") {
- intelligenceGain = 10;
- } else if (petState.trainingStyle === "chaotic") {
- intelligenceGain = 2;
- }
- petState.intelligence = Math.max(0, petState.intelligence + intelligenceGain);
- petState.accuracy = Math.min(100, petState.accuracy + 3);
- petState.experience += 15;
- if (petState.overfitRisk > 50) {
- petState.accuracy = Math.max(0, petState.accuracy - 10);
- showThought("I'm overfitting! Help! 😰");
- updateStatus("Warning: Network is overfitting to noise!");
- } else {
- showThought("Learning patterns! 🎯");
- updateStatus("Training session complete!");
- }
- animateNetworkActivity();
- updateStats();
- // Check for level up
- checkLevelUp();
- }
- function scoldNetwork() {
- if (petState.overfitRisk < 30) {
- showThought("But I'm doing fine! 😕");
- petState.happiness = Math.max(0, petState.happiness - 5);
- updateStatus("Network doesn't need scolding right now.");
- } else {
- petState.overfitRisk = Math.max(0, petState.overfitRisk - 25);
- petState.happiness = Math.max(0, petState.happiness - 10);
- petState.accuracy = Math.min(100, petState.accuracy + 5);
- showThought("I'll generalize better! 📚");
- updateStatus("Network learned to avoid overfitting!");
- }
- updateStats();
- }
- function solvePuzzle(type) {
- closeModal('puzzleModal');
- // Puzzle success depends on intelligence, energy, happiness, accuracy, and feeding history
- let baseSuccessChance = (petState.intelligence / 1000) * 0.5; // Intelligence factor (scaled)
- baseSuccessChance += (petState.energy / 100) * 0.2;
- baseSuccessChance += (petState.happiness / 100) * 0.2;
- baseSuccessChance += (petState.accuracy / 100) * 0.1;
- // Adjust based on feeding history matching puzzle type
- let feedingBonus = 0;
- const recentFeeds = petState.feedHistory.slice(-3);
- if (type === 'pattern' && recentFeeds.includes('clean')) {
- feedingBonus = 0.3;
- } else if (type === 'classification' && recentFeeds.includes('balanced')) {
- feedingBonus = 0.3;
- } else if (type === 'prediction' && recentFeeds.includes('noisy')) {
- feedingBonus = 0.3;
- }
- const successChance = Math.min(0.95, baseSuccessChance + feedingBonus);
- const success = Math.random() < successChance;
- if (success) {
- const reward = Math.floor(Math.random() * 50) + 50; // Larger rewards for puzzles
- petState.intelligence = Math.max(0, petState.intelligence + reward);
- petState.happiness = Math.min(100, petState.happiness + 15);
- petState.experience += 50;
- showThought(`Solved the ${type} puzzle! 🎉`);
- updateStatus(`Successfully solved the ${type} puzzle! Intelligence +${reward}!`);
- // Track puzzle performance for evolution
- petState.puzzleHistory.push({type: type, success: true});
- } else {
- petState.happiness = Math.max(0, petState.happiness - 10);
- petState.experience += 20;
- showThought(`This ${type} is hard... 🤔`);
- updateStatus(`Failed the ${type} puzzle. Keep training!`);
- petState.puzzleHistory.push({type: type, success: false});
- }
- // Limit puzzle history
- if (petState.puzzleHistory.length > 10) {
- petState.puzzleHistory.shift();
- }
- animateNetworkActivity();
- updateStats();
- // Check for level up
- checkLevelUp();
- }
- function updateTrainingStyle() {
- // Analyze feeding history to determine training style
- const feedCounts = {
- clean: 0,
- noisy: 0,
- balanced: 0
- };
- petState.feedHistory.forEach(feed => {
- feedCounts[feed]++;
- });
- const totalFeeds = petState.feedHistory.length;
- if (totalFeeds === 0) return;
- const cleanRatio = feedCounts.clean / totalFeeds;
- const noisyRatio = feedCounts.noisy / totalFeeds;
- const balancedRatio = feedCounts.balanced / totalFeeds;
- if (balancedRatio > 0.5) {
- petState.trainingStyle = "balanced";
- } else if (noisyRatio > 0.5) {
- petState.trainingStyle = "chaotic";
- } else if (cleanRatio > 0.5) {
- petState.trainingStyle = "precise";
- } else {
- petState.trainingStyle = "mixed";
- }
- }
- function determineEvolution() {
- // Complex evolution based on nurturing style, performance, and history
- let baseIndex = 0;
- let adjectiveIndex = 0;
- // Base determined by level and primary feeding type
- baseIndex = Math.min(petState.level - 1, evolutionBases.length - 1);
- // Adjective determined by training style, puzzle performance, and intelligence
- if (petState.trainingStyle === "balanced" && petState.intelligence > 500) {
- adjectiveIndex = 10 + Math.min(Math.floor(petState.intelligence / 100), 10);
- } else if (petState.trainingStyle === "precise") {
- adjectiveIndex = 20 + Math.min(Math.floor(petState.accuracy / 10), 10);
- } else if (petState.trainingStyle === "chaotic") {
- adjectiveIndex = 30 + Math.min(petState.puzzleHistory.filter(p => p.success).length, 10);
- } else {
- adjectiveIndex = Math.min(Math.floor(petState.level / 2), evolutionAdjectives.length - 1);
- }
- // Ensure indices are within bounds
- adjectiveIndex = Math.min(adjectiveIndex, evolutionAdjectives.length - 1);
- return {
- base: evolutionBases[baseIndex],
- adjective: evolutionAdjectives[adjectiveIndex],
- fullName: `${evolutionAdjectives[adjectiveIndex]} ${evolutionBases[baseIndex]}`
- };
- }
- function animateNetworkActivity() {
- petState.neurons.forEach(neuron => {
- setTimeout(() => {
- if (Math.random() > 0.5) {
- neuron.element.classList.add('active');
- setTimeout(() => neuron.element.classList.remove('active'), 500);
- }
- }, Math.random() * 1000);
- });
- }
- function updateStatus(message) {
- document.getElementById('statusMessage').textContent = message;
- }
- function checkLevelUp() {
- if (petState.experience >= 100) {
- // Level up!
- petState.level++;
- petState.experience = 0;
- // Determine new evolution
- const evolution = determineEvolution();
- const oldName = document.getElementById('petName').textContent;
- // Show evolution modal
- document.getElementById('newName').textContent = evolution.fullName;
- document.getElementById('evolutionMessage').textContent =
- `Your ${oldName} has evolved into a ${evolution.fullName}!`;
- document.getElementById('evolutionModal').classList.add('show');
- // Update the pet name
- document.getElementById('petName').textContent = evolution.fullName;
- // Track evolution path
- petState.evolutionPath.push(evolution.fullName);
- // Show celebration
- showThought(`I've evolved! I'm now a ${evolution.fullName}! 🎉`);
- updateStatus(`Your neural network has reached level ${petState.level}!`);
- // Add some stat bonuses for leveling up
- petState.intelligence = Math.max(0, petState.intelligence + 20);
- petState.accuracy = Math.min(100, petState.accuracy + 5);
- petState.happiness = Math.min(100, petState.happiness + 15);
- petState.energy = Math.min(100, petState.energy + 30);
- updateStats();
- }
- }
- function closeEvolutionModal() {
- document.getElementById('evolutionModal').classList.remove('show');
- }
- // Automatic processes
- setInterval(() => {
- // Age the network
- petState.age++;
- // Natural stat changes
- petState.energy = Math.min(100, petState.energy + 2);
- petState.happiness = Math.max(0, petState.happiness - 1);
- // Data corruption and cosmic radiation - decrease progress by 0.24% every second
- petState.experience = Math.max(0, petState.experience - 0.24);
- // Random thoughts
- if (Math.random() > 0.95) {
- const thoughts = [
- "I wonder about gradients... 🤔",
- "Neurons firing! ⚡",
- "Processing... 💭",
- "Optimizing weights! 🎯",
- "Learning is fun! 📚",
- "Data corruption detected... 🛡️",
- "Cosmic radiation affecting my progress! 🌌",
- "I need more training data! 📊",
- "My intelligence is growing! 🧠",
- "These puzzles are challenging my limits! 💪"
- ];
- showThought(thoughts[Math.floor(Math.random() * thoughts.length)]);
- }
- updateStats();
- }, 1000);
- // Initialize on load
- window.onload = () => {
- initializeNetwork();
- updateStats();
- showThought("Hello! I'm ready to learn! 👋");
- };
- // Responsive network resize
- window.onresize = () => {
- const network = document.getElementById('neuralNetwork');
- network.innerHTML = '<div class="thought-bubble" id="thoughtBubble"></div>';
- initializeNetwork();
- };
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment