interactiveReasoning commited on
Commit
2868eda
·
verified ·
1 Parent(s): 9afbe76

Delete interactive_code_right_NA_41.html

Browse files
Files changed (1) hide show
  1. interactive_code_right_NA_41.html +0 -492
interactive_code_right_NA_41.html DELETED
@@ -1,492 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Problem-Solving Interface</title>
7
- <style>
8
- * {
9
- box-sizing: border-box;
10
- margin: 0;
11
- padding: 0;
12
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
13
- }
14
-
15
- body {
16
- background-color: #f5f5f5;
17
- color: #333;
18
- line-height: 1.6;
19
- }
20
-
21
- .container {
22
- display: flex;
23
- width: 100%;
24
- height: 800px;
25
- border: 1px solid #ddd;
26
- background-color: white;
27
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
28
- }
29
-
30
- .left-panel {
31
- width: 40%;
32
- display: flex;
33
- flex-direction: column;
34
- border-right: 1px solid #ddd;
35
- }
36
-
37
- .right-panel {
38
- width: 60%;
39
- display: flex;
40
- flex-direction: column;
41
- }
42
-
43
- .problem-statement, .problem-understanding {
44
- padding: 20px;
45
- overflow-y: auto;
46
- }
47
-
48
- .problem-statement {
49
- height: 50%;
50
- border-bottom: 1px solid #ddd;
51
- }
52
-
53
- .problem-understanding {
54
- height: 50%;
55
- }
56
-
57
- .section-title {
58
- font-size: 1.4rem;
59
- font-weight: 600;
60
- margin-bottom: 15px;
61
- color: #2c3e50;
62
- border-bottom: 2px solid #3498db;
63
- padding-bottom: 5px;
64
- display: inline-block;
65
- }
66
-
67
- .debugger-controls {
68
- display: flex;
69
- padding: 10px;
70
- background-color: #f8f9fa;
71
- border-bottom: 1px solid #ddd;
72
- gap: 5px;
73
- }
74
-
75
- .btn {
76
- display: flex;
77
- align-items: center;
78
- justify-content: center;
79
- padding: 8px 15px;
80
- border: none;
81
- border-radius: 4px;
82
- cursor: pointer;
83
- font-weight: 500;
84
- font-size: 14px;
85
- transition: all 0.2s ease;
86
- }
87
-
88
- .btn:hover:not(.disabled) {
89
- opacity: 0.9;
90
- transform: translateY(-1px);
91
- }
92
-
93
- .btn-play-pause {
94
- background-color: #2ecc71;
95
- color: white;
96
- }
97
-
98
- .btn-stop {
99
- background-color: #e74c3c;
100
- color: white;
101
- }
102
-
103
- .btn-prev, .btn-next {
104
- background-color: #3498db;
105
- color: white;
106
- }
107
-
108
- .disabled {
109
- opacity: 0.5;
110
- cursor: not-allowed;
111
- }
112
-
113
- .python-solution {
114
- height: 400px;
115
- border: 1px solid #ddd;
116
- margin: 10px;
117
- border-radius: 4px;
118
- overflow: hidden;
119
- background-color: #ffffff;
120
- color: #333333;
121
- font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
122
- }
123
-
124
- .python-code {
125
- padding: 15px;
126
- height: calc(100% - 50px);
127
- overflow-y: auto;
128
- font-size: 14px;
129
- line-height: 1.5;
130
- }
131
-
132
- .code-line {
133
- display: flex;
134
- align-items: center;
135
- padding: 4px 0;
136
- position: relative;
137
- transition: all 0.3s ease;
138
- }
139
-
140
- .code-line.current {
141
- background-color: #ffeb3b;
142
- color: #000;
143
- padding-left: 8px;
144
- }
145
-
146
- .line-number {
147
- color: #888;
148
- font-size: 12px;
149
- min-width: 20px;
150
- text-align: right;
151
- margin-right: 15px;
152
- }
153
-
154
- .comment {
155
- color: #347778;
156
- }
157
-
158
- .variables-display {
159
- height: 300px;
160
- border: 1px solid #ddd;
161
- margin: 10px;
162
- border-radius: 4px;
163
- background-color: #f8f9fa;
164
- overflow-y: auto;
165
- padding: 15px;
166
- }
167
-
168
- .variable-item {
169
- display: flex;
170
- justify-content: space-between;
171
- align-items: center;
172
- padding: 8px 12px;
173
- margin: 5px 0;
174
- border-radius: 6px;
175
- border-left: 4px solid #3498db;
176
- font-weight: 500;
177
- }
178
-
179
- .variable-name {
180
- font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
181
- }
182
-
183
- .variable-value {
184
- font-weight: 600;
185
- }
186
-
187
- .fact1-color { background-color: rgba(255, 99, 71, 0.5); }
188
- .fact2-color { background-color: rgba(135, 206, 250, 0.5); }
189
- .var1-color { background-color: rgba(144, 238, 144, 0.5); }
190
- .var2-color { background-color: rgba(255, 165, 0, 0.5); }
191
- .var3-color { background-color: rgba(211, 160, 211, 0.5); }
192
- .var4-color { background-color: rgba(255, 217, 0, 0.5); }
193
- .var5-color { background-color: rgba(70, 130, 180, 0.5); }
194
-
195
- ul {
196
- padding-left: 20px;
197
- }
198
-
199
- li {
200
- margin-bottom: 12px;
201
- }
202
-
203
- .what-to-find {
204
- margin-top: 20px;
205
- padding: 15px;
206
- background-color: #e8f4fd;
207
- border-radius: 6px;
208
- border-left: 4px solid #3498db;
209
- }
210
-
211
- .what-to-find h4 {
212
- color: #2c3e50;
213
- margin-bottom: 8px;
214
- }
215
- .wrong-step {
216
- display: none;
217
- }
218
-
219
- </style>
220
- </head>
221
- <body>
222
- <div class="wrong-step">0</div>
223
- <div class="container">
224
- <div class="left-panel">
225
- <div class="problem-statement">
226
- <div class="section-title">Problem Statement</div>
227
- <p>
228
- A bathroom has <span id="fact1" class="fact1-color">10 6 inch tiles along its width</span> and <span id="fact2" class="fact2-color">20 6 inch tiles along its length</span>. What is the square footage of the bathroom?
229
- </p>
230
- </div>
231
- <div class="problem-understanding">
232
- <div class="section-title">Problem Summary</div>
233
- <ul>
234
- <li><span class="fact1-color">Width tiles: 10 tiles of 6 inches each</span></li>
235
- <li><span class="fact2-color">Length tiles: 20 tiles of 6 inches each</span></li>
236
- </ul>
237
- <div class="what-to-find">
238
- <h4>What we need to find</h4>
239
- <p>Calculate the square footage of the bathroom.</p>
240
- </div>
241
- </div>
242
- </div>
243
- <div class="right-panel">
244
- <div class="debugger-controls">
245
- <button id="playPauseBtn" class="btn btn-play-pause">▶ Play</button>
246
- <button id="stopBtn" class="btn btn-stop">■ Stop</button>
247
- <button id="prevBtn" class="btn btn-prev">⤴ Previous Step</button>
248
- <button id="nextBtn" class="btn btn-next">⤵ Next Step</button>
249
- </div>
250
- <div class="python-solution">
251
- <div class="section-title" style="color: #333333; padding: 15px 15px 0; margin: 0;">Python Solution</div>
252
- <div class="python-code" id="python-code">
253
- <div class="code-line" data-step="0">
254
- <span class="line-number">1</span>
255
- <span class="comment"># Calculate the total width of the bathroom in inches</span>
256
- </div>
257
- <div class="code-line" data-step="1">
258
- <span class="line-number">2</span>
259
- <span><span class="var1-color">width_inches</span> = <span class="fact1-color">10</span> * 6</span>
260
- </div>
261
- <div class="code-line" data-step="2">
262
- <span class="line-number">3</span>
263
- <span class="comment"># Convert the width from inches to feet</span>
264
- </div>
265
- <div class="code-line" data-step="3">
266
- <span class="line-number">4</span>
267
- <span><span class="var2-color">width_feet</span> = <span class="var1-color">width_inches</span> / 12</span>
268
- </div>
269
- <div class="code-line" data-step="4">
270
- <span class="line-number">5</span>
271
- <span class="comment"># Calculate the total length of the bathroom in inches</span>
272
- </div>
273
- <div class="code-line" data-step="5">
274
- <span class="line-number">6</span>
275
- <span><span class="var3-color">length_inches</span> = <span class="fact2-color">20</span> * 6</span>
276
- </div>
277
- <div class="code-line" data-step="6">
278
- <span class="line-number">7</span>
279
- <span class="comment"># Convert the length from inches to feet</span>
280
- </div>
281
- <div class="code-line" data-step="7">
282
- <span class="line-number">8</span>
283
- <span><span class="var4-color">length_feet</span> = <span class="var3-color">length_inches</span> / 12</span>
284
- </div>
285
- <div class="code-line" data-step="8">
286
- <span class="line-number">9</span>
287
- <span class="comment"># Calculate the square footage of the bathroom</span>
288
- </div>
289
- <div class="code-line" data-step="9">
290
- <span class="line-number">10</span>
291
- <span><span class="var5-color">bathroom_area</span> = <span class="var4-color">length_feet</span> * <span class="var2-color">width_feet</span></span>
292
- </div>
293
- </div>
294
- </div>
295
- <div class="variables-display" id="variables-display">
296
- <div class="section-title" style="margin-bottom: 15px;">Variables</div>
297
- <div id="variables-list">
298
- <div class="variable-item">
299
- <span class="variable-name">No variables initialized yet</span>
300
- <span class="variable-value">Run the code to see variables</span>
301
- </div>
302
- </div>
303
- </div>
304
- </div>
305
- </div>
306
-
307
- <script>
308
- class PythonDebugger {
309
- constructor() {
310
- this.currentStep = -1;
311
- this.isPlaying = false;
312
- this.playInterval = null;
313
- this.totalSteps = 9;
314
- this.variables = {};
315
-
316
- this.initializeElements();
317
- this.bindEvents();
318
- this.updateUI();
319
- }
320
-
321
- initializeElements() {
322
- this.playPauseBtn = document.getElementById('playPauseBtn');
323
- this.stopBtn = document.getElementById('stopBtn');
324
- this.prevBtn = document.getElementById('prevBtn');
325
- this.nextBtn = document.getElementById('nextBtn');
326
- this.codeLines = document.querySelectorAll('.code-line');
327
- this.variablesDisplay = document.getElementById('variables-list');
328
- }
329
-
330
- bindEvents() {
331
- this.playPauseBtn.addEventListener('click', () => this.togglePlay());
332
- this.stopBtn.addEventListener('click', () => this.stop());
333
- this.prevBtn.addEventListener('click', () => this.previousStep());
334
- this.nextBtn.addEventListener('click', () => this.nextStep());
335
- }
336
-
337
- togglePlay() {
338
- if (this.isPlaying) {
339
- this.pause();
340
- } else {
341
- this.play();
342
- }
343
- }
344
-
345
- play() {
346
- this.isPlaying = true;
347
- this.playPauseBtn.innerHTML = '❚❚ Pause';
348
-
349
- if (this.currentStep >= this.totalSteps) {
350
- this.currentStep = -1;
351
- }
352
-
353
- this.playInterval = setInterval(() => {
354
- if (this.currentStep < this.totalSteps) {
355
- this.currentStep++;
356
- this.executeStep(this.currentStep);
357
- this.updateUI();
358
- } else {
359
- this.pause();
360
- }
361
- }, 1500);
362
- }
363
-
364
- pause() {
365
- this.isPlaying = false;
366
- this.playPauseBtn.innerHTML = '▶ Play';
367
- if (this.playInterval) {
368
- clearInterval(this.playInterval);
369
- this.playInterval = null;
370
- }
371
- }
372
-
373
- stop() {
374
- this.pause();
375
- this.currentStep = -1;
376
- this.variables = {};
377
- this.updateUI();
378
- }
379
-
380
- nextStep() {
381
- if (this.currentStep < this.totalSteps) {
382
- this.currentStep++;
383
- this.executeStep(this.currentStep);
384
- this.updateUI();
385
- }
386
- }
387
-
388
- previousStep() {
389
- if (this.currentStep > 0) {
390
- this.currentStep--;
391
- this.recalculateVariables();
392
- this.updateUI();
393
- } else if (this.currentStep === 0) {
394
- this.currentStep = -1;
395
- this.variables = {};
396
- this.updateUI();
397
- }
398
- }
399
-
400
- executeStep(step) {
401
- switch(step) {
402
- case 1:
403
- this.variables.width_inches = 10 * 6;
404
- break;
405
- case 3:
406
- this.variables.width_feet = this.variables.width_inches / 12;
407
- break;
408
- case 5:
409
- this.variables.length_inches = 20 * 6;
410
- break;
411
- case 7:
412
- this.variables.length_feet = this.variables.length_inches / 12;
413
- break;
414
- case 9:
415
- this.variables.bathroom_area = this.variables.length_feet * this.variables.width_feet;
416
- break;
417
- }
418
- }
419
-
420
- recalculateVariables() {
421
- this.variables = {};
422
- for (let i = 1; i <= this.currentStep; i += 2) {
423
- this.executeStep(i);
424
- }
425
- }
426
-
427
- updateUI() {
428
- // Update code highlighting
429
- this.codeLines.forEach((line, index) => {
430
- line.classList.toggle('current', index === this.currentStep);
431
- });
432
-
433
- // Update button states
434
- this.prevBtn.classList.toggle('disabled', this.currentStep === -1);
435
- this.nextBtn.classList.toggle('disabled', this.currentStep === this.totalSteps);
436
-
437
- // Update variables display
438
- this.updateVariablesDisplay();
439
- }
440
-
441
- updateVariablesDisplay() {
442
- if (Object.keys(this.variables).length === 0) {
443
- this.variablesDisplay.innerHTML = `
444
- <div class="variable-item">
445
- <span class="variable-name">No variables initialized yet</span>
446
- <span class="variable-value">Run the code to see variables</span>
447
- </div>
448
- `;
449
- return;
450
- }
451
-
452
- let html = '';
453
- const variableOrder = ['width_inches', 'width_feet', 'length_inches', 'length_feet', 'bathroom_area'];
454
-
455
- variableOrder.forEach(varName => {
456
- if (this.variables.hasOwnProperty(varName)) {
457
- const value = this.variables[varName];
458
- const colorClass = this.getVariableColorClass(varName);
459
- const displayValue = varName === 'bathroom_area' ? `${value} sq feet` :
460
- (varName.includes('feet') ? `${value} feet` : `${value} inches`);
461
-
462
- html += `
463
- <div class="variable-item ${colorClass}">
464
- <span class="variable-name">${varName}</span>
465
- <span class="variable-value">${displayValue}</span>
466
- </div>
467
- `;
468
- }
469
- });
470
-
471
- this.variablesDisplay.innerHTML = html;
472
- }
473
-
474
- getVariableColorClass(varName) {
475
- const colorMap = {
476
- 'width_inches': 'var1-color',
477
- 'width_feet': 'var2-color',
478
- 'length_inches': 'var3-color',
479
- 'length_feet': 'var4-color',
480
- 'bathroom_area': 'var5-color'
481
- };
482
- return colorMap[varName] || '';
483
- }
484
- }
485
-
486
- // Initialize the debugger when the page loads
487
- document.addEventListener('DOMContentLoaded', () => {
488
- new PythonDebugger();
489
- });
490
- </script>
491
- </body>
492
- </html>