study-buddy-site / index.html
raayraay's picture
Add 2 files
5ef1c06 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ADHD Linear Programming Study Buddy</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
@keyframes shake {
0%, 100% { transform: rotate(0deg); }
25% { transform: rotate(5deg); }
75% { transform: rotate(-5deg); }
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.floating {
animation: float 3s ease-in-out infinite;
}
.shaking {
animation: shake 0.5s ease-in-out infinite;
}
.pulsing {
animation: pulse 1.5s ease-in-out infinite;
}
.progress-bar {
transition: width 0.5s ease-in-out;
}
.constraint-line {
stroke-dasharray: 5;
animation: dash 30s linear infinite;
}
@keyframes dash {
to {
stroke-dashoffset: 1000;
}
}
.feasible-region {
fill-opacity: 0.3;
animation: colorChange 10s infinite alternate;
}
@keyframes colorChange {
0% { fill: #3B82F6; }
25% { fill: #10B981; }
50% { fill: #F59E0B; }
75% { fill: #EC4899; }
100% { fill: #8B5CF6; }
}
.highlight-box {
transition: all 0.3s ease;
}
.highlight-box:hover {
transform: scale(1.02);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.confetti {
position: absolute;
width: 10px;
height: 10px;
background-color: #f00;
opacity: 0;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
<div class="container mx-auto px-4 py-8">
<!-- Header with progress tracker -->
<header class="mb-8">
<div class="flex justify-between items-center mb-6">
<h1 class="text-4xl font-bold text-indigo-800 flex items-center">
<i class="fas fa-brain mr-3 text-pink-500 floating"></i>
LP Study Buddy
</h1>
<div class="flex items-center space-x-4">
<div class="relative">
<div class="h-4 w-32 bg-gray-200 rounded-full overflow-hidden">
<div id="progress-bar" class="progress-bar h-full bg-green-500" style="width: 0%"></div>
</div>
<span id="progress-text" class="text-xs font-semibold text-gray-600 absolute -bottom-5 right-0">0% Complete</span>
</div>
<button id="focus-mode" class="px-3 py-1 bg-blue-100 text-blue-700 rounded-full text-sm flex items-center">
<i class="fas fa-crosshairs mr-1"></i> Focus Mode
</button>
</div>
</div>
<div class="bg-white p-4 rounded-xl shadow-md mb-6">
<div class="flex items-center">
<div class="mr-4">
<div class="w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center">
<i class="fas fa-lightbulb text-yellow-500 text-2xl shaking"></i>
</div>
</div>
<div>
<h2 class="text-xl font-bold text-gray-800">ADHD Study Tips</h2>
<p class="text-gray-600" id="study-tip">Work in short bursts (10-15 min) with breaks in between!</p>
<div class="flex space-x-2 mt-2">
<button id="prev-tip" class="px-2 py-1 bg-gray-100 rounded text-sm">
<i class="fas fa-arrow-left"></i>
</button>
<button id="next-tip" class="px-2 py-1 bg-gray-100 rounded text-sm">
<i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
</div>
</div>
</header>
<!-- Main content area with tabs -->
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
<!-- Sidebar with navigation -->
<div class="lg:col-span-1">
<div class="bg-white p-4 rounded-xl shadow-md sticky top-4">
<h3 class="font-bold text-lg mb-4 text-indigo-700 flex items-center">
<i class="fas fa-list-ul mr-2"></i> Topics
</h3>
<ul class="space-y-2">
<li>
<button data-tab="formulating" class="tab-btn w-full text-left px-3 py-2 rounded-lg bg-indigo-50 text-indigo-700 font-medium flex items-center justify-between">
<span>1. Formulating Problems</span>
<i class="fas fa-check-circle text-green-500 opacity-0"></i>
</button>
</li>
<li>
<button data-tab="graphical" class="tab-btn w-full text-left px-3 py-2 rounded-lg hover:bg-indigo-50 text-gray-700 flex items-center justify-between">
<span>2. Graphical Solutions</span>
<i class="fas fa-check-circle text-green-500 opacity-0"></i>
</button>
</li>
<li>
<button data-tab="standard-form" class="tab-btn w-full text-left px-3 py-2 rounded-lg hover:bg-indigo-50 text-gray-700 flex items-center justify-between">
<span>3. Standard Form</span>
<i class="fas fa-check-circle text-green-500 opacity-0"></i>
</button>
</li>
<li>
<button data-tab="simplex" class="tab-btn w-full text-left px-3 py-2 rounded-lg hover:bg-indigo-50 text-gray-700 flex items-center justify-between">
<span>4. Simplex Method</span>
<i class="fas fa-check-circle text-green-500 opacity-0"></i>
</button>
</li>
<li>
<button data-tab="duality" class="tab-btn w-full text-left px-3 py-2 rounded-lg hover:bg-indigo-50 text-gray-700 flex items-center justify-between">
<span>5. Duality</span>
<i class="fas fa-check-circle text-green-500 opacity-0"></i>
</button>
</li>
</ul>
<div class="mt-6 pt-4 border-t border-gray-200">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-gamepad mr-2"></i> Quick Games
</h3>
<button id="flashcards-btn" class="w-full mb-2 px-3 py-2 bg-purple-100 text-purple-700 rounded-lg flex items-center">
<i class="fas fa-layer-group mr-2"></i> Flashcards
</button>
<button id="quiz-btn" class="w-full px-3 py-2 bg-green-100 text-green-700 rounded-lg flex items-center">
<i class="fas fa-question-circle mr-2"></i> Pop Quiz
</button>
</div>
<div class="mt-6 pt-4 border-t border-gray-200">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-tools mr-2"></i> Tools
</h3>
<div class="flex space-x-2">
<button id="timer-btn" class="flex-1 px-3 py-2 bg-blue-100 text-blue-700 rounded-lg flex items-center justify-center">
<i class="fas fa-stopwatch mr-2"></i> Timer
</button>
<button id="distraction-btn" class="flex-1 px-3 py-2 bg-pink-100 text-pink-700 rounded-lg flex items-center justify-center">
<i class="fas fa-headphones mr-2"></i> Sounds
</button>
</div>
</div>
</div>
</div>
<!-- Main content -->
<div class="lg:col-span-3">
<!-- Formulating Problems Tab -->
<div id="formulating" class="tab-content active">
<div class="bg-white rounded-xl shadow-md overflow-hidden highlight-box">
<div class="p-5">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">1. Formulating Linear Programming Problems</h2>
<p class="text-gray-600 mb-4">Turning real-world problems into mathematical equations</p>
</div>
<button class="complete-topic px-4 py-2 bg-green-500 text-white rounded-lg flex items-center">
<i class="fas fa-check mr-2"></i> Mark Complete
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-lightbulb mr-2 text-yellow-500"></i> Key Concepts
</h3>
<ul class="space-y-2">
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Objective Function:</strong> What you want to maximize or minimize</span>
</li>
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Constraints:</strong> Limitations or requirements</span>
</li>
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Decision Variables:</strong> What you can control</span>
</li>
</ul>
<h3 class="font-bold text-lg mt-6 mb-3 text-indigo-700 flex items-center">
<i class="fas fa-bolt mr-2 text-purple-500"></i> ADHD Tips
</h3>
<div class="bg-blue-50 p-3 rounded-lg">
<p class="text-blue-800"><i class="fas fa-star mr-2 text-yellow-500"></i> <strong>Make it fun:</strong> Use examples from your life (tacos, video games, etc.)</p>
<p class="text-blue-800 mt-2"><i class="fas fa-star mr-2 text-yellow-500"></i> <strong>Quick sketch:</strong> Jot down variables and constraints without perfection</p>
</div>
</div>
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-pencil-alt mr-2 text-green-500"></i> Example
</h3>
<div class="bg-gray-50 p-4 rounded-lg">
<p class="font-semibold">Taco & Burger Stand:</p>
<p class="text-sm text-gray-600 mb-2">You have 10 buns and 5 patties. Tacos need 1 bun, burgers need 1 bun + 1 patty. Profit: $2/taco, $3/burger.</p>
<div class="space-y-2">
<div class="flex items-center">
<span class="bg-indigo-100 text-indigo-800 px-2 py-1 rounded mr-2 text-sm">Goal</span>
<span>Maximize Profit: <span class="font-mono">P = 2x + 3y</span></span>
</div>
<div class="flex items-center">
<span class="bg-pink-100 text-pink-800 px-2 py-1 rounded mr-2 text-sm">Constraints</span>
<span>Buns: <span class="font-mono">x + y ≤ 10</span></span>
</div>
<div class="flex items-center">
<span class="bg-pink-100 text-pink-800 px-2 py-1 rounded mr-2 text-sm">Constraints</span>
<span>Patties: <span class="font-mono">y ≤ 5</span></span>
</div>
<div class="flex items-center">
<span class="bg-green-100 text-green-800 px-2 py-1 rounded mr-2 text-sm">Variables</span>
<span><span class="font-mono">x ≥ 0, y ≥ 0</span></span>
</div>
</div>
</div>
<button id="example-animation-btn" class="mt-4 px-4 py-2 bg-indigo-600 text-white rounded-lg flex items-center">
<i class="fas fa-play mr-2"></i> Show Animation
</button>
</div>
</div>
<div class="border-t border-gray-200 pt-4">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-dumbbell mr-2 text-red-500"></i> Practice
</h3>
<div class="bg-orange-50 p-4 rounded-lg">
<p class="font-medium mb-2">Pizza & Wings:</p>
<p class="text-sm text-gray-600 mb-3">You have 20 slices of pizza and 30 wings. A pizza party needs 4 slices, a wing party needs 10 wings. Profit: $15/pizza party, $20/wing party.</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Objective Function:</label>
<input type="text" class="practice-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="P = ...">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Constraints:</label>
<input type="text" class="practice-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="Pizza slices...">
<input type="text" class="practice-input w-full mt-2 px-3 py-2 border border-gray-300 rounded-md" placeholder="Wings...">
</div>
</div>
<button id="check-practice" class="px-4 py-2 bg-orange-500 text-white rounded-lg flex items-center">
<i class="fas fa-check-circle mr-2"></i> Check Answer
</button>
<div id="practice-feedback" class="mt-3 hidden"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Graphical Solutions Tab -->
<div id="graphical" class="tab-content">
<div class="bg-white rounded-xl shadow-md overflow-hidden highlight-box">
<div class="p-5">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">2. Graphical Solutions (2D Problems)</h2>
<p class="text-gray-600 mb-4">Visualizing and solving LP problems with two variables</p>
</div>
<button class="complete-topic px-4 py-2 bg-green-500 text-white rounded-lg flex items-center">
<i class="fas fa-check mr-2"></i> Mark Complete
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-lightbulb mr-2 text-yellow-500"></i> Key Concepts
</h3>
<ul class="space-y-2">
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Plot constraints:</strong> Draw each inequality as a line</span>
</li>
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Feasible region:</strong> Where all constraints overlap</span>
</li>
<li class="flex items-start">
<i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
<span><strong>Optimal solution:</strong> At a corner point of the feasible region</span>
</li>
</ul>
<h3 class="font-bold text-lg mt-6 mb-3 text-indigo-700 flex items-center">
<i class="fas fa-bolt mr-2 text-purple-500"></i> ADHD Tips
</h3>
<div class="bg-blue-50 p-3 rounded-lg">
<p class="text-blue-800"><i class="fas fa-star mr-2 text-yellow-500"></i> <strong>Use colors:</strong> Different colors for each constraint</p>
<p class="text-blue-800 mt-2"><i class="fas fa-star mr-2 text-yellow-500"></i> <strong>Interactive tools:</strong> Try online graphing calculators</p>
</div>
</div>
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-chart-line mr-2 text-green-500"></i> Interactive Graph
</h3>
<div class="bg-gray-100 p-4 rounded-lg">
<div id="graph-container" class="w-full h-64 relative">
<svg id="graph-svg" width="100%" height="100%" viewBox="0 0 400 300" class="bg-white rounded">
<!-- Axes -->
<line x1="50" y1="250" x2="350" y2="250" stroke="black" stroke-width="2" />
<line x1="50" y1="250" x2="50" y2="50" stroke="black" stroke-width="2" />
<!-- X axis labels -->
<text x="350" y="265" text-anchor="middle">x</text>
<text x="60" y="265" text-anchor="middle">0</text>
<text x="110" y="265" text-anchor="middle">2</text>
<text x="160" y="265" text-anchor="middle">4</text>
<text x="210" y="265" text-anchor="middle">6</text>
<text x="260" y="265" text-anchor="middle">8</text>
<text x="310" y="265" text-anchor="middle">10</text>
<!-- Y axis labels -->
<text x="35" y="60" text-anchor="middle">10</text>
<text x="35" y="110" text-anchor="middle">8</text>
<text x="35" y="160" text-anchor="middle">6</text>
<text x="35" y="210" text-anchor="middle">4</text>
<text x="35" y="260" text-anchor="middle">0</text>
<text x="30" y="40" text-anchor="middle">y</text>
<!-- Constraints will be added here by JavaScript -->
</svg>
</div>
<div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-2">
<button id="add-constraint-btn" class="px-3 py-2 bg-blue-100 text-blue-700 rounded flex items-center justify-center">
<i class="fas fa-plus mr-2"></i> Add Constraint
</button>
<button id="find-optimal-btn" class="px-3 py-2 bg-green-100 text-green-700 rounded flex items-center justify-center">
<i class="fas fa-bullseye mr-2"></i> Find Optimal
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Standard Form Tab -->
<div id="standard-form" class="tab-content">
<div class="bg-white rounded-xl shadow-md overflow-hidden highlight-box">
<div class="p-5">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">3. Conversion to Standard Form</h2>
<p class="text-gray-600 mb-4">Rewriting LP problems for the simplex method</p>
</div>
<button class="complete-topic px-4 py-2 bg-green-500 text-white rounded-lg flex items-center">
<i class="fas fa-check mr-2"></i> Mark Complete
</button>
</div>
<div class="mb-6">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-exchange-alt mr-2 text-purple-500"></i> Conversion Rules
</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-bold text-blue-700 mb-2 flex items-center">
<i class="fas fa-less-than-equal mr-2"></i> ≤ Constraints
</h4>
<p class="text-sm">Add a <span class="font-mono bg-blue-100 px-1">slack variable</span>:</p>
<p class="font-mono mt-1">x + y ≤ 10 → x + y + s = 10</p>
<p class="text-xs text-gray-500 mt-2">s ≥ 0</p>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-bold text-green-700 mb-2 flex items-center">
<i class="fas fa-greater-than-equal mr-2"></i> ≥ Constraints
</h4>
<p class="text-sm">Add a <span class="font-mono bg-green-100 px-1">surplus variable</span>:</p>
<p class="font-mono mt-1">x + y ≥ 10 → x + y - s = 10</p>
<p class="text-xs text-gray-500 mt-2">s ≥ 0</p>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-bold text-red-700 mb-2 flex items-center">
<i class="fas fa-random mr-2"></i> Free Variables
</h4>
<p class="text-sm">Replace with difference:</p>
<p class="font-mono mt-1">x unrestricted → x = x⁺ - x⁻</p>
<p class="text-xs text-gray-500 mt-2">x⁺ ≥ 0, x⁻ ≥ 0</p>
</div>
</div>
</div>
<div class="border-t border-gray-200 pt-4">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-dumbbell mr-2 text-red-500"></i> Practice
</h3>
<div class="bg-orange-50 p-4 rounded-lg">
<div class="mb-4">
<p class="font-medium">Convert to standard form:</p>
<p class="text-sm font-mono bg-white p-2 rounded mt-1">Maximize z = 3x₁ + 2x₂</p>
<p class="text-sm font-mono bg-white p-2 rounded">Subject to: x₁ + x₂ ≤ 4</p>
<p class="text-sm font-mono bg-white p-2 rounded">x₁ - x₂ ≥ 1</p>
<p class="text-sm font-mono bg-white p-2 rounded">x₁ ≥ 0, x₂ unrestricted</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Objective:</label>
<input type="text" class="std-form-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="Maximize...">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Constraints:</label>
<input type="text" class="std-form-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="First constraint...">
<input type="text" class="std-form-input w-full mt-2 px-3 py-2 border border-gray-300 rounded-md" placeholder="Second constraint...">
</div>
</div>
<button id="check-std-form" class="px-4 py-2 bg-orange-500 text-white rounded-lg flex items-center">
<i class="fas fa-check-circle mr-2"></i> Check Answer
</button>
<div id="std-form-feedback" class="mt-3 hidden"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Simplex Method Tab -->
<div id="simplex" class="tab-content">
<div class="bg-white rounded-xl shadow-md overflow-hidden highlight-box">
<div class="p-5">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">4. Simplex Method</h2>
<p class="text-gray-600 mb-4">Step-by-step algorithm for solving LP problems</p>
</div>
<button class="complete-topic px-4 py-2 bg-green-500 text-white rounded-lg flex items-center">
<i class="fas fa-check mr-2"></i> Mark Complete
</button>
</div>
<div class="mb-6">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-list-ol mr-2 text-purple-500"></i> Steps
</h3>
<div class="space-y-4">
<div class="flex items-start">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3">1</div>
<div>
<p class="font-medium">Set up initial tableau</p>
<p class="text-sm text-gray-600">Include slack/surplus variables and objective function</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3">2</div>
<div>
<p class="font-medium">Choose pivot column</p>
<p class="text-sm text-gray-600">Most negative entry in bottom row (for minimization)</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3">3</div>
<div>
<p class="font-medium">Choose pivot row</p>
<p class="text-sm text-gray-600">Smallest non-negative ratio (RHS ÷ pivot column)</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3">4</div>
<div>
<p class="font-medium">Perform row operations</p>
<p class="text-sm text-gray-600">Make pivot element 1, others in column 0</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0 mr-3">5</div>
<div>
<p class="font-medium">Repeat until optimal</p>
<p class="text-sm text-gray-600">No negatives in bottom row (minimization)</p>
</div>
</div>
</div>
</div>
<div class="border-t border-gray-200 pt-4">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-table mr-2 text-green-500"></i> Interactive Tableau
</h3>
<div class="bg-gray-100 p-4 rounded-lg">
<div class="overflow-x-auto">
<table id="simplex-table" class="w-full bg-white border border-gray-200">
<thead>
<tr>
<th class="border px-4 py-2">Basic</th>
<th class="border px-4 py-2">x₁</th>
<th class="border px-4 py-2">x₂</th>
<th class="border px-4 py-2">s₁</th>
<th class="border px-4 py-2">s₂</th>
<th class="border px-4 py-2">RHS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border px-4 py-2">s₁</td>
<td class="border px-4 py-2">1</td>
<td class="border px-4 py-2">1</td>
<td class="border px-4 py-2">1</td>
<td class="border px-4 py-2">0</td>
<td class="border px-4 py-2">4</td>
</tr>
<tr>
<td class="border px-4 py-2">s₂</td>
<td class="border px-4 py-2">1</td>
<td class="border px-4 py-2">-1</td>
<td class="border px-4 py-2">0</td>
<td class="border px-4 py-2">-1</td>
<td class="border px-4 py-2">1</td>
</tr>
<tr class="bg-gray-50">
<td class="border px-4 py-2">z</td>
<td class="border px-4 py-2">-3</td>
<td class="border px-4 py-2">-2</td>
<td class="border px-4 py-2">0</td>
<td class="border px-4 py-2">0</td>
<td class="border px-4 py-2">0</td>
</tr>
</tbody>
</table>
</div>
<div class="mt-4 grid grid-cols-2 md:grid-cols-4 gap-2">
<button id="step-simplex" class="px-3 py-2 bg-blue-500 text-white rounded flex items-center justify-center">
<i class="fas fa-forward mr-2"></i> Next Step
</button>
<button id="reset-simplex" class="px-3 py-2 bg-gray-500 text-white rounded flex items-center justify-center">
<i class="fas fa-undo mr-2"></i> Reset
</button>
<button id="hint-simplex" class="px-3 py-2 bg-yellow-500 text-white rounded flex items-center justify-center">
<i class="fas fa-lightbulb mr-2"></i> Hint
</button>
<button id="auto-simplex" class="px-3 py-2 bg-green-500 text-white rounded flex items-center justify-center">
<i class="fas fa-robot mr-2"></i> Auto Solve
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Duality Tab -->
<div id="duality" class="tab-content">
<div class="bg-white rounded-xl shadow-md overflow-hidden highlight-box">
<div class="p-5">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">5. Duality</h2>
<p class="text-gray-600 mb-4">Understanding the dual problem and its relationship to the primal</p>
</div>
<button class="complete-topic px-4 py-2 bg-green-500 text-white rounded-lg flex items-center">
<i class="fas fa-check mr-2"></i> Mark Complete
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-project-diagram mr-2 text-purple-500"></i> Primal to Dual Rules
</h3>
<div class="space-y-4">
<div class="bg-gray-50 p-3 rounded-lg">
<p class="font-medium text-blue-700">Maximization → Minimization</p>
<p class="text-sm">(and vice versa)</p>
</div>
<div class="bg-gray-50 p-3 rounded-lg">
<p class="font-medium text-green-700">Constraints → Variables</p>
<p class="text-sm">Each primal constraint becomes a dual variable</p>
</div>
<div class="bg-gray-50 p-3 rounded-lg">
<p class="font-medium text-red-700">Variables → Constraints</p>
<p class="text-sm">Each primal variable becomes a dual constraint</p>
</div>
<div class="bg-gray-50 p-3 rounded-lg">
<p class="font-medium text-yellow-700">Coefficients transpose</p>
<p class="text-sm">Constraint matrix flips rows and columns</p>
</div>
</div>
</div>
<div>
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-balance-scale mr-2 text-green-500"></i> Example
</h3>
<div class="bg-gray-100 p-4 rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<p class="font-medium text-center mb-2">Primal</p>
<div class="bg-white p-3 rounded">
<p class="text-sm font-mono">Max z = 3x₁ + 2x₂</p>
<p class="text-sm font-mono mt-1">x₁ + x₂ ≤ 4</p>
<p class="text-sm font-mono">x₁ - x₂ ≤ 1</p>
<p class="text-sm font-mono">x₁, x₂ ≥ 0</p>
</div>
</div>
<div>
<p class="font-medium text-center mb-2">Dual</p>
<div class="bg-white p-3 rounded">
<p class="text-sm font-mono">Min w = 4y₁ + y₂</p>
<p class="text-sm font-mono mt-1">y₁ + y₂ ≥ 3</p>
<p class="text-sm font-mono">y₁ - y₂ ≥ 2</p>
<p class="text-sm font-mono">y₁, y₂ ≥ 0</p>
</div>
</div>
</div>
<button id="duality-animation-btn" class="mt-4 w-full px-4 py-2 bg-indigo-600 text-white rounded-lg flex items-center justify-center">
<i class="fas fa-magic mr-2"></i> Show Transformation
</button>
</div>
</div>
</div>
<div class="border-t border-gray-200 pt-4">
<h3 class="font-bold text-lg mb-3 text-indigo-700 flex items-center">
<i class="fas fa-dumbbell mr-2 text-red-500"></i> Practice
</h3>
<div class="bg-orange-50 p-4 rounded-lg">
<p class="font-medium mb-2">Find the dual of:</p>
<div class="bg-white p-3 rounded mb-4">
<p class="text-sm font-mono">Min z = 2x₁ + 5x₂</p>
<p class="text-sm font-mono mt-1">3x₁ + x₂ ≥ 6</p>
<p class="text-sm font-mono">x₁ + 2x₂ ≥ 4</p>
<p class="text-sm font-mono">x₁, x₂ ≥ 0</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Objective:</label>
<input type="text" class="dual-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="Min/Max...">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Constraints:</label>
<input type="text" class="dual-input w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="First constraint...">
<input type="text" class="dual-input w-full mt-2 px-3 py-2 border border-gray-300 rounded-md" placeholder="Second constraint...">
</div>
</div>
<button id="check-dual" class="px-4 py-2 bg-orange-500 text-white rounded-lg flex items-center">
<i class="fas fa-check-circle mr-2"></i> Check Answer
</button>
<div id="dual-feedback" class="mt-3 hidden"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modals -->
<div id="flashcards-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
<div class="p-5">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Flashcards</h3>
<button id="close-flashcards" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="bg-blue-50 p-6 rounded-lg h-64 flex items-center justify-center">
<div id="flashcard-content" class="text-center">
<p class="text-lg font-medium">Click "Next" to start!</p>
</div>
</div>
<div class="flex justify-between mt-6">
<button id="prev-card" class="px-4 py-2 bg-gray-200 rounded-lg">
<i class="fas fa-arrow-left mr-2"></i> Previous
</button>
<button id="next-card" class="px-4 py-2 bg-indigo-600 text-white rounded-lg">
Next <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
</div>
<div id="quiz-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
<div class="p-5">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Pop Quiz</h3>
<button id="close-quiz" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div id="quiz-question" class="mb-4">
<p class="font-medium mb-3">What is the first step in formulating an LP problem?</p>
<div class="space-y-2">
<label class="flex items-center space-x-2 p-2 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="quiz-answer" class="form-radio" value="A">
<span>Draw a graph</span>
</label>
<label class="flex items-center space-x-2 p-2 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="quiz-answer" class="form-radio" value="B">
<span>Identify the objective function</span>
</label>
<label class="flex items-center space-x-2 p-2 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="quiz-answer" class="form-radio" value="C">
<span>Add slack variables</span>
</label>
</div>
</div>
<div class="flex justify-between mt-6">
<div id="quiz-score" class="text-sm text-gray-600">Score: 0/0</div>
<button id="submit-quiz" class="px-4 py-2 bg-indigo-600 text-white rounded-lg">
Submit <i class="fas fa-check ml-2"></i>
</button>
</div>
</div>
</div>
</div>
<div id="timer-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
<div class="p-5">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Focus Timer</h3>
<button id="close-timer" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="text-center mb-6">
<div class="text-5xl font-bold mb-2" id="timer-display">25:00</div>
<div class="text-gray-500">Minutes Remaining</div>
</div>
<div class="grid grid-cols-3 gap-2 mb-4">
<button data-minutes="5" class="timer-preset px-3 py-2 bg-blue-100 text-blue-700 rounded-lg">
5 min
</button>
<button data-minutes="15" class="timer-preset px-3 py-2 bg-blue-100 text-blue-700 rounded-lg">
15 min
</button>
<button data-minutes="25" class="timer-preset px-3 py-2 bg-blue-100 text-blue-700 rounded-lg">
25 min
</button>
</div>
<div class="flex justify-center space-x-4 mt-6">
<button id="start-timer" class="px-4 py-2 bg-green-500 text-white rounded-lg">
<i class="fas fa-play mr-2"></i> Start
</button>
<button id="pause-timer" class="px-4 py-2 bg-yellow-500 text-white rounded-lg">
<i class="fas fa-pause mr-2"></i> Pause
</button>
<button id="reset-timer" class="px-4 py-2 bg-red-500 text-white rounded-lg">
<i class="fas fa-stop mr-2"></i> Stop
</button>
</div>
</div>
</div>
</div>
<div id="distraction-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
<div class="p-5">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Focus Sounds</h3>
<button id="close-distraction" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="space-y-3">
<label class="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="sound" class="form-radio" value="rain">
<div class="flex-1">
<div class="font-medium">Rain</div>
<div class="text-sm text-gray-500">Gentle rainfall</div>
</div>
<i class="fas fa-volume-up text-gray-400"></i>
</label>
<label class="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="sound" class="form-radio" value="coffee">
<div class="flex-1">
<div class="font-medium">Coffee Shop</div>
<div class="text-sm text-gray-500">Ambient chatter</div>
</div>
<i class="fas fa-volume-up text-gray-400"></i>
</label>
<label class="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="sound" class="form-radio" value="white">
<div class="flex-1">
<div class="font-medium">White Noise</div>
<div class="text-sm text-gray-500">Static sound</div>
</div>
<i class="fas fa-volume-up text-gray-400"></i>
</label>
<label class="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="sound" class="form-radio" value="none">
<div class="flex-1">
<div class="font-medium">None</div>
<div class="text-sm text-gray-500">Silence</div>
</div>
</label>
</div>
<div class="mt-6">
<label class="flex items-center space-x-2">
<input type="range" id="volume-control" min="0" max="1" step="0.1" value="0.5" class="w-full">
<span class="text-sm text-gray-600 w-10 text-right">50%</span>
</label>
</div>
</div>
</div>
</div>
<script>
// Study tips
const studyTips = [
"Work in short bursts (10-15 min) with breaks in between!",
"Use colorful pens or markers to make notes more engaging.",
"Try explaining concepts out loud to an imaginary friend.",
"Create silly mnemonics to remember key concepts.",
"Reward yourself after completing each topic.",
"Use movement - pace while reviewing or sit on an exercise ball.",
"Chew gum or have a fidget toy to help focus.",
"Make up real-world examples that interest you.",
"Record yourself explaining concepts and listen back.",
"Change study locations frequently to stay engaged."
];
let currentTipIndex = 0;
document.getElementById('study-tip').textContent = studyTips[currentTipIndex];
document.getElementById('next-tip').addEventListener('click', () => {
currentTipIndex = (currentTipIndex + 1) % studyTips.length;
document.getElementById('study-tip').textContent = studyTips[currentTipIndex];
});
document.getElementById('prev-tip').addEventListener('click', () => {
currentTipIndex = (currentTipIndex - 1 + studyTips.length) % studyTips.length;
document.getElementById('study-tip').textContent = studyTips[currentTipIndex];
});
// Tab navigation
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
const tabId = btn.getAttribute('data-tab');
// Hide all tab contents
document.querySelectorAll('.tab-content').forEach(tab => {
tab.classList.remove('active');
});
// Show selected tab
document.getElementById(tabId).classList.add('active');
// Update active tab button
document.querySelectorAll('.tab-btn').forEach(t => {
t.classList.remove('bg-indigo-50', 'text-indigo-700');
t.classList.add('hover:bg-indigo-50', 'text-gray-700');
});
btn.classList.remove('hover:bg-indigo-50', 'text-gray-700');
btn.classList.add('bg-indigo-50', 'text-indigo-700');
});
});
// Mark topic complete
document.querySelectorAll('.complete-topic').forEach(btn => {
btn.addEventListener('click', function() {
const topicId = this.closest('.tab-content').id;
const tabBtn = document.querySelector(`.tab-btn[data-tab="${topicId}"]`);
// Add checkmark
const checkIcon = tabBtn.querySelector('i');
checkIcon.classList.remove('opacity-0');
// Update progress
updateProgress();
// Confetti effect
createConfetti(this);
});
});
function updateProgress() {
const completedTopics = document.querySelectorAll('.tab-btn i:not(.opacity-0)').length;
const totalTopics = document.querySelectorAll('.tab-btn').length;
const percentage = Math.round((completedTopics / totalTopics) * 100);
document.getElementById('progress-bar').style.width = `${percentage}%`;
document.getElementById('progress-text').textContent = `${percentage}% Complete`;
}
function createConfetti(element) {
const rect = element.getBoundingClientRect();
const colors = ['#f00', '#0f0', '#00f', '#ff0', '#f0f', '#0ff'];
for (let i = 0; i < 50; i++) {
const confetti = document.createElement('div');
confetti.className = 'confetti';
confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
confetti.style.left = `${rect.left + rect.width/2}px`;
confetti.style.top = `${rect.top}px`;
confetti.style.transform = `rotate(${Math.random() * 360}deg)`;
document.body.appendChild(confetti);
const animation = confetti.animate([
{ transform: `translate(0, 0) rotate(0)`, opacity: 1 },
{ transform: `translate(${Math.random() * 200 - 100}px, ${window.innerHeight}px) rotate(${Math.random() * 360}deg)`, opacity: 0 }
], {
duration: 1000 + Math.random() * 2000,
easing: 'cubic-bezier(0.1, 0.8, 0.3, 1)'
});
animation.onfinish = () => confetti.remove();
}
}
// Example animation
document.getElementById('example-animation-btn').addEventListener('click', function() {
const exampleDiv = this.previousElementSibling;
exampleDiv.classList.add('pulsing');
setTimeout(() => {
exampleDiv.classList.remove('pulsing');
}, 1500);
});
// Graphical solutions
let constraints = [];
document.getElementById('add-constraint-btn').addEventListener('click', function() {
const newConstraint = prompt("Enter constraint (e.g., x + y ≤ 10):");
if (newConstraint) {
constraints.push(newConstraint);
updateGraph();
}
});
document.getElementById('find-optimal-btn').addEventListener('click', function() {
alert("Finding optimal solution at corner points...");
// In a real implementation, we would calculate the optimal solution
});
function updateGraph() {
const svg = document.getElementById('graph-svg');
// Clear existing constraints
svg.querySelectorAll('.constraint-line, .feasible-region').forEach(el => el.remove());
// Add new constraints
constraints.forEach((constraint, index) => {
const color = ['#3B82F6', '#10B981', '#F59E0B', '#EC4899', '#8B5CF6'][index % 5];
// This is a simplified version - in a real app, we'd parse the constraint
const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
line.setAttribute('x1', '50');
line.setAttribute('y1', '250');
line.setAttribute('x2', '350');
line.setAttribute('y2', '50');
line.setAttribute('stroke', color);
line.setAttribute('stroke-width', '2');
line.setAttribute('stroke-dasharray', '5');
line.classList.add('constraint-line');
svg.appendChild(line);
// Add label
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
text.setAttribute('x', '300');
text.setAttribute('y', '40');
text.setAttribute('fill', color);
text.setAttribute('font-size', '12');
text.textContent = constraint;
svg.appendChild(text);
});
// Add feasible region (simplified)
if (constraints.length >= 2) {
const polygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
polygon.setAttribute('points', '150,150 200,100 250,150 200,200');
polygon.setAttribute('fill', '#3B82F6');
polygon.classList.add('feasible-region');
svg.appendChild(polygon);
}
}
// Flashcards
const flashcards = [
{ question: "What is the objective function?", answer: "The function you want to maximize or minimize in an LP problem." },
{ question: "What are constraints?", answer: "Limitations or requirements in an LP problem, expressed as inequalities or equations." },
{ question: "What is the feasible region?", answer: "The set of all possible points that satisfy all constraints." },
{ question: "What is the simplex method?", answer: "An algorithm for solving LP problems by moving from one vertex of the feasible region to another." },
{ question: "What is duality in LP?", answer: "Every LP problem has a corresponding dual problem with interesting relationships." }
];
let currentCardIndex = 0;
let showingAnswer = false;
document.getElementById('flashcards-btn').addEventListener('click', function() {
document.getElementById('flashcards-modal').classList.remove('hidden');
showFlashcardQuestion();
});
document.getElementById('close-flashcards').addEventListener('click', function() {
document.getElementById('flashcards-modal').classList.add('hidden');
});
document.getElementById('next-card').addEventListener('click', function() {
if (showingAnswer) {
currentCardIndex = (currentCardIndex + 1) % flashcards.length;
showFlashcardQuestion();
} else {
showFlashcardAnswer();
}
});
document.getElementById('prev-card').addEventListener('click', function() {
if (!showingAnswer) {
currentCardIndex = (currentCardIndex - 1 + flashcards.length) % flashcards.length;
showFlashcardQuestion();
}
});
function showFlashcardQuestion() {
const card = flashcards[currentCardIndex];
document.getElementById('flashcard-content').innerHTML = `
<p class="text-lg font-medium mb-4">${card.question}</p>
<button id="show-answer" class="px-3 py-1 bg-blue-100 text-blue-700 rounded-full text-sm">
Show Answer
</button>
`;
showingAnswer = false;
document.getElementById('show-answer').addEventListener('click', showFlashcardAnswer);
}
function showFlashcardAnswer() {
const card = flashcards[currentCardIndex];
document.getElementById('flashcard-content').innerHTML = `
<p class="text-lg font-medium mb-2">${card.question}</p>
<p class="text-gray-700">${card.answer}</p>
`;
showingAnswer = true;
}
// Quiz
const quizQuestions = [
{
question: "What is the first step in formulating an LP problem?",
options: ["Draw a graph", "Identify the objective function", "Add slack variables"],
answer: "B"
},
{
question: "Where is the optimal solution found in graphical LP?",
options: ["At the center of the feasible region", "At a corner point", "Anywhere on a constraint line"],
answer: "B"
},
{
question: "What do you add to convert a ≤ constraint to standard form?",
options: ["Surplus variable", "Slack variable", "Artificial variable"],
answer: "B"
}
];
let currentQuestionIndex = 0;
let quizScore = 0;
document.getElementById('quiz-btn').addEventListener('click', function() {
document.getElementById('quiz-modal').classList.remove('hidden');
showQuizQuestion();
});
document.getElementById('close-quiz').addEventListener('click', function() {
document.getElementById('quiz-modal').classList.add('hidden');
});
document.getElementById('submit-quiz').addEventListener('click', function() {
const selectedOption = document.querySelector('input[name="quiz-answer"]:checked');
if (selectedOption) {
if (selectedOption.value === quizQuestions[currentQuestionIndex].answer) {
quizScore++;
alert("Correct! 🎉");
} else {
alert(`Incorrect. The correct answer is ${quizQuestions[currentQuestionIndex].answer}.`);
}
currentQuestionIndex++;
if (currentQuestionIndex < quizQuestions.length) {
showQuizQuestion();
} else {
alert(`Quiz complete! Your score: ${quizScore}/${quizQuestions.length}`);
document.getElementById('quiz-modal').classList.add('hidden');
currentQuestionIndex = 0;
quizScore = 0;
}
document.getElementById('quiz-score').textContent = `Score: ${quizScore}/${currentQuestionIndex}`;
} else {
alert("Please select an answer!");
}
});
function showQuizQuestion() {
const question = quizQuestions[currentQuestionIndex];
document.getElementById('quiz-question').innerHTML = `
<p class="font-medium mb-3">${question.question}</p>
<div class="space-y-2">
${question.options.map((opt, i) => `
<label class="flex items-center space-x-2 p-2 border rounded-lg hover:bg-gray-50 cursor-pointer">
<input type="radio" name="quiz-answer" class="form-radio" value="${String.fromCharCode(65 + i)}">
<span>${opt}</span>
</label>
`).join('')}
</div>
`;
}
// Timer
let timerInterval;
let timeLeft = 25 * 60; // 25 minutes in seconds
document.getElementById('timer-btn').addEventListener('click', function() {
document.getElementById('timer-modal').classList.remove('hidden');
updateTimerDisplay();
});
document.getElementById('close-timer').addEventListener('click', function() {
document.getElementById('timer-modal').classList.add('hidden');
});
document.querySelectorAll('.timer-preset').forEach(btn => {
btn.addEventListener('click', function() {
const minutes = parseInt(this.getAttribute('data-minutes'));
timeLeft = minutes * 60;
updateTimerDisplay();
});
});
document.getElementById('start-timer').addEventListener('click', function() {
if (!timerInterval) {
timerInterval = setInterval(() => {
timeLeft--;
updateTimerDisplay();
if (timeLeft <= 0) {
clearInterval(timerInterval);
timerInterval = null;
alert("Time's up! Take a break!");
}
}, 1000);
}
});
document.getElementById('pause-timer').addEventListener('click', function() {
if (timerInterval) {
clearInterval(timerInterval);
timerInterval = null;
}
});
document.getElementById('reset-timer').addEventListener('click', function() {
if (timerInterval) {
clearInterval(timerInterval);
timerInterval = null;
}
timeLeft = 25 * 60;
updateTimerDisplay();
});
function updateTimerDisplay() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
document.getElementById('timer-display').textContent =
`${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
}
// Distraction sounds
document.getElementById('distraction-btn').addEventListener('click', function() {
document.getElementById('distraction-modal').classList.remove('hidden');
});
document.getElementById('close-distraction').addEventListener('click', function() {
document.getElementById('distraction-modal').classList.add('hidden');
});
document.getElementById('volume-control').addEventListener('input', function() {
document.querySelector('.text-right').textContent = `${this.value * 100}%`;
});
// Focus mode
document.getElementById('focus-mode').addEventListener('click', function() {
document.body.classList.toggle('bg-gray-900');
document.querySelector('.container').classList.toggle('text-white');
document.querySelectorAll('.bg-white').forEach(el => el.classList.toggle('bg-gray-800'));
document.querySelectorAll('.text-gray-800').forEach(el => el.classList.toggle('text-gray-200'));
document.querySelectorAll('.text-gray-600').forEach(el => el.classList.toggle('text-gray-400'));
if (document.body.classList.contains('bg-gray-900')) {
this.innerHTML = '<i class="fas fa-sun mr-1"></i> Light Mode';
} else {
this.innerHTML = '<i class="fas fa-crosshairs mr-1"></i> Focus Mode';
}
});
// Practice feedback
document.getElementById('check-practice').addEventListener('click', function() {
const feedback = document.getElementById('practice-feedback');
feedback.classList.remove('hidden');
feedback.innerHTML = `
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
<p>Good attempt! Here's the correct formulation:</p>
<p class="font-mono mt-1">Max P = 15x + 20y</p>
<p class="font-mono">4x ≤ 20</p>
<p class="font-mono">10y ≤ 30</p>
<p class="font-mono">x, y ≥ 0</p>
</div>
`;
});
document.getElementById('check-std-form').addEventListener('click', function() {
const feedback = document.getElementById('std-form-feedback');
feedback.classList.remove('hidden');
feedback.innerHTML = `
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
<p>Correct standard form would be:</p>
<p class="font-mono mt-1">Maximize z = 3x₁ + 2x₂⁺ - 2x₂⁻</p>
<p class="font-mono">x₁ + x₂⁺ - x₂⁻ + s₁ = 4</p>
<p class="font-mono">x₁ - x₂⁺ + x₂⁻ - s₂ = 1</p>
<p class="font-mono">x₁, x₂⁺, x₂⁻, s₁, s₂ ≥ 0</p>
</div>
`;
});
document.getElementById('check-dual').addEventListener('click', function() {
const feedback = document.getElementById('dual-feedback');
feedback.classList.remove('hidden');
feedback.innerHTML = `
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
<p>The dual problem is:</p>
<p class="font-mono mt-1">Max w = 6y₁ + 4y₂</p>
<p class="font-mono">3y₁ + y₂ ≤ 2</p>
<p class="font-mono">y₁ + 2y₂ ≤ 5</p>
<p class="font-mono">y₁, y₂ ≥ 0</p>
</div>
`;
});
// Simplex method interaction
document.getElementById('step-simplex').addEventListener('click', function() {
alert("Performing next simplex iteration...");
// In a real implementation, we would update the tableau
});
document.getElementById('hint-simplex').addEventListener('click', function() {
alert("Hint: Look for the most negative number in the bottom row to choose the pivot column.");
});
document.getElementById('auto-simplex').addEventListener('click', function() {
alert("Automatically solving the problem...");
// In a real implementation, we would solve the entire problem
});
document.getElementById('reset-simplex').addEventListener('click', function() {
alert("Resetting the tableau to initial state...");
// In a real implementation, we would reset the tableau
});
// Duality animation
document.getElementById('duality-animation-btn').addEventListener('click', function() {
const exampleDiv = this.closest('.bg-gray-100');
exampleDiv.classList.add('pulsing');
setTimeout(() => {
exampleDiv.classList.remove('pulsing');
}, 1500);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=raayraay/study-buddy-site" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>