-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
89 lines (82 loc) · 3.91 KB
/
index.html
File metadata and controls
89 lines (82 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mechanical Binary Counter Visualizer</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<header>
<h1>Mechanical Binary Counter</h1>
<p class="subtitle">Experience binary arithmetic with realistic mechanical animations</p>
</header>
<main>
<section class="counter-section">
<div class="counter-container">
<div class="bit-container" id="bitContainer">
<!-- Bits will be dynamically generated here -->
</div>
</div>
<div class="display-section">
<div class="value-display">
<div class="display-item">
<label>Binary:</label>
<span id="binaryDisplay" class="binary-value">0000</span>
</div>
<div class="display-item">
<label>Decimal:</label>
<span id="decimalDisplay" class="decimal-value">0</span>
</div>
<div class="display-item">
<label>Max Value:</label>
<span id="maxDisplay" class="max-value">15</span>
</div>
</div>
</div>
</section>
<section class="controls-section">
<div class="control-group">
<button id="incrementBtn" class="btn btn-primary">
<span class="btn-icon">+</span>
Increment
</button>
<button id="resetBtn" class="btn btn-secondary">
<span class="btn-icon">↻</span>
Reset
</button>
</div>
<div class="control-group">
<div class="bit-controls">
<label for="bitInput">Manage Bits:</label>
<div class="input-group">
<input type="number" id="bitInput" min="1" max="8" value="1" class="bit-input">
<button id="addBitBtn" class="btn btn-accent">Add Bit</button>
<button id="removeBitBtn" class="btn btn-warning">Remove Bit</button>
</div>
</div>
</div>
<div class="status-section">
<div id="statusMessage" class="status-message"></div>
<div class="overflow-indicator" id="overflowIndicator">
<span class="indicator-light"></span>
<span class="indicator-text">Overflow Ready</span>
</div>
</div>
</section>
<section class="info-section">
<details class="info-panel">
<summary>How It Works</summary>
<div class="info-content">
<p><strong>Binary Counter:</strong> Each bit represents a power of 2. The rightmost bit is 2⁰ (1), the next is 2¹ (2), then 2² (4), and so on.</p>
<p><strong>Integer Overflow:</strong> When all bits are 1 and you increment, the counter resets to 0, demonstrating overflow behavior.</p>
<p><strong>Adding/Removing Bits:</strong> Increase or decrease the counter's capacity by adding or removing bits. This lets you prevent overflow or demonstrate it at different values.</p>
</div>
</details>
</section>
</main>
</div>
<script src="script.js"></script>
</body>
</html>