Skip to content

Commit d3112d1

Browse files
authored
Add files via upload
0 parents  commit d3112d1

File tree

3 files changed

+1060
-0
lines changed

3 files changed

+1060
-0
lines changed

index.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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>Mechanical Binary Counter Visualizer</title>
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<header>
12+
<h1>Mechanical Binary Counter</h1>
13+
<p class="subtitle">Experience binary arithmetic with realistic mechanical animations</p>
14+
</header>
15+
16+
<main>
17+
<section class="counter-section">
18+
<div class="counter-container">
19+
<div class="bit-container" id="bitContainer">
20+
<!-- Bits will be dynamically generated here -->
21+
</div>
22+
</div>
23+
24+
<div class="display-section">
25+
<div class="value-display">
26+
<div class="display-item">
27+
<label>Binary:</label>
28+
<span id="binaryDisplay" class="binary-value">0000</span>
29+
</div>
30+
<div class="display-item">
31+
<label>Decimal:</label>
32+
<span id="decimalDisplay" class="decimal-value">0</span>
33+
</div>
34+
<div class="display-item">
35+
<label>Max Value:</label>
36+
<span id="maxDisplay" class="max-value">15</span>
37+
</div>
38+
</div>
39+
</div>
40+
</section>
41+
42+
<section class="controls-section">
43+
<div class="control-group">
44+
<button id="incrementBtn" class="btn btn-primary">
45+
<span class="btn-icon">+</span>
46+
Increment
47+
</button>
48+
<button id="resetBtn" class="btn btn-secondary">
49+
<span class="btn-icon"></span>
50+
Reset
51+
</button>
52+
</div>
53+
54+
<div class="control-group">
55+
<div class="bit-controls">
56+
<label for="bitInput">Manage Bits:</label>
57+
<div class="input-group">
58+
<input type="number" id="bitInput" min="1" max="8" value="1" class="bit-input">
59+
<button id="addBitBtn" class="btn btn-accent">Add Bit</button>
60+
<button id="removeBitBtn" class="btn btn-warning">Remove Bit</button>
61+
</div>
62+
</div>
63+
</div>
64+
65+
<div class="status-section">
66+
<div id="statusMessage" class="status-message"></div>
67+
<div class="overflow-indicator" id="overflowIndicator">
68+
<span class="indicator-light"></span>
69+
<span class="indicator-text">Overflow Ready</span>
70+
</div>
71+
</div>
72+
</section>
73+
74+
<section class="info-section">
75+
<details class="info-panel">
76+
<summary>How It Works</summary>
77+
<div class="info-content">
78+
<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>
79+
<p><strong>Integer Overflow:</strong> When all bits are 1 and you increment, the counter resets to 0, demonstrating overflow behavior.</p>
80+
<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>
81+
</div>
82+
</details>
83+
</section>
84+
</main>
85+
</div>
86+
87+
<script src="script.js"></script>
88+
</body>
89+
</html>

0 commit comments

Comments
 (0)