Wave 2 Beta Release

 Wave 2 Beta Release: New Logic Gates, Improved UX, and Major Enhancements! 

---

## **🆕 New Features**
### **1️⃣ Additional Logic Gates**
#### **🔲 NAND Gate**
- **Fully functional NAND logic** implemented.
- **Truth Table**:
  | **Input A** | **Input B** | **Output (A NAND B)** |
  |-------------|-------------|-----------------------|
  | 0           | 0           | **1** (ON)            |
  | 0           | 1           | **1** (ON)            |
  | 1           | 0           | **1** (ON)            |
  | 1           | 1           | **0** (OFF)           |
- **Toggle buttons** for Input 1 and Input 2 work as expected.
- Lightbulb updates correctly to match the logic output.

#### **🔲 NOR Gate**
- **Fully functional NOR logic** implemented.
- **Truth Table**:
  | **Input A** | **Input B** | **Output (A NOR B)** |
  |-------------|-------------|----------------------|
  | 0           | 0           | **1** (ON)           |
  | 0           | 1           | **0** (OFF)          |
  | 1           | 0           | **0** (OFF)          |
  | 1           | 1           | **0** (OFF)          |
- Lightbulb updates correctly to match the logic output.
- Toggle buttons for Input 1 and Input 2 work as expected.

#### **🔲 XOR Gate**
- **Fully functional XOR logic** implemented.
- **Truth Table**:
  | **Input A** | **Input B** | **Output (A XOR B)** |
  |-------------|-------------|----------------------|
  | 0           | 0           | **0** (OFF)          |
  | 0           | 1           | **1** (ON)           |
  | 1           | 0           | **1** (ON)           |
  | 1           | 1           | **0** (OFF)          |
- Toggle buttons for Input 1 and Input 2 trigger the logic updates.
- Lightbulb behavior reflects the XOR output logic.

#### **🔲 XNOR Gate**
- **Fully functional XNOR logic** implemented.
- **Truth Table**:
  | **Input A** | **Input B** | **Output (A XNOR B)** |
  |-------------|-------------|-----------------------|
  | 0           | 0           | **1** (ON)            |
  | 0           | 1           | **0** (OFF)           |
  | 1           | 0           | **0** (OFF)           |
  | 1           | 1           | **1** (ON)            |
- Lightbulb updates correctly based on the logic.
- Input toggle buttons work correctly for Input 1 and Input 2.

---

## **🛠️ Enhancements & Improvements**
- **Input Handling**:
  - **Input toggles** now work consistently across all logic gate types (AND, OR, NOT, XOR, NOR, NAND, XNOR).
  - Input logic is consistent across all gate types, including the lightbulb status updates.

- **Reset Functionality**:
  - The **reset button** now works across all logic gates.
  - The lightbulb and toggle button status are properly reset.

- **Code Refactoring**:
  - Reduced **redundancy** in the toggle input functions.
  - Enhanced **code readability** and maintainability.
  - Removed unnecessary logic duplications and consolidated shared logic for gate input handling.

---

## **🐛 Bug Fixes**
- **Fixed NAND Gate logic** — lightbulb now correctly updates according to the truth table.
- **Fixed XNOR Gate logic** — logic now correctly handles the logic for matching inputs.
- **Fixed Reset Functionality** — lightbulbs and buttons now reset correctly across all gate types.
- **General Bug Fixes** — Minor improvements in input toggle functions for better user experience.

---

## **📁 Files Changed**
📄 logicGates.js 📄 logicGates.html

---

## **🚀 Release Notes**
This release marks the **Wave 2 Beta** of the CS:Box project, bringing support for all fundamental logic gates. This wave includes the **NAND, NOR, XOR, and XNOR gates**, which have been built with consistent logic, responsive lightbulb behavior, and proper input handling. This release also introduces major fixes to the **reset functionality**, ensuring that all gates reset properly when the reset button is pressed.

**New Features Include:**
- Full support for **NAND, NOR, XOR, XNOR logic gates**.
- Input toggle buttons now work seamlessly for all gates.
- Lightbulb status updates in real-time according to input changes.
- **Reset button** now clears all input states and correctly resets the lightbulb status for each gate type.

**Looking Ahead**:
- Further UI improvements to make the interface more user-friendly.
- Expanded testing to ensure accurate logic across all devices.

Enjoy this latest version of CS:Box! 🚀
This commit is contained in:
2024-12-07 23:46:18 +00:00
parent a247bc036e
commit d4441afd55
18 changed files with 1180 additions and 188 deletions

View File

@@ -1,6 +1,6 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -9,7 +9,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -18,7 +18,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -27,7 +27,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -36,7 +36,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -45,7 +45,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -54,7 +54,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: italic;
font-display: swap;
@@ -63,7 +63,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -72,7 +72,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -81,7 +81,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -90,7 +90,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -99,7 +99,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -108,7 +108,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -117,7 +117,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -126,7 +126,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -135,7 +135,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -144,7 +144,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -153,7 +153,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -162,7 +162,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -171,7 +171,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -180,7 +180,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
@@ -189,7 +189,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -198,7 +198,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -207,7 +207,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -216,7 +216,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -225,7 +225,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -234,7 +234,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -243,7 +243,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -252,7 +252,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-501638185f142ea970e06ff6a896cf44.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -261,7 +261,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d845be6713e4acd3766e1f8f6418c97e.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -270,7 +270,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8d07e5f373f5bb3603b3e139f63e3386.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -279,7 +279,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8e1d10adf40d7223fbee98b930853a8a.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -288,7 +288,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-db78de5246196d0d93187248cbebc6c2.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -297,7 +297,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-6b97bb4aa11fb6d8c29b378b87c8ce45.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -306,7 +306,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-69c9fb2f299f5f5be8d2800cd24271f9.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: italic;
font-display: swap;
@@ -315,7 +315,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -324,7 +324,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -333,7 +333,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -342,7 +342,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -351,7 +351,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -360,7 +360,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -369,7 +369,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 300;
font-style: normal;
font-display: swap;
@@ -378,7 +378,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -387,7 +387,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -396,7 +396,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -405,7 +405,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -414,7 +414,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -423,7 +423,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -432,7 +432,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -441,7 +441,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -450,7 +450,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -459,7 +459,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -468,7 +468,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -477,7 +477,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -486,7 +486,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -495,7 +495,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 600;
font-style: normal;
font-display: swap;
@@ -504,7 +504,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -513,7 +513,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -522,7 +522,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -531,7 +531,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -540,7 +540,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -549,7 +549,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -558,7 +558,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -567,7 +567,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-9f11e6095a39b5e188d6a081f05299fb.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -576,7 +576,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-c0b8741a9d891c8088e6db8ca3a4b5fa.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -585,7 +585,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-991ff15c49155ffbda53e3aa14ecb8b6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -594,7 +594,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-8b0bd5934b903f2631853751aedf28a6.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -603,7 +603,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-aa0964911973a0fbaf081bae32a490f3.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -612,7 +612,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-1b621eda4be3428e50a0ee070c09005b.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;
@@ -621,7 +621,7 @@
@font-face {
font-family: 'Inter';
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=22b95cd67c81e5664b0c191202b83c10) format('woff2');
src: url(/assets/fonts/Inter-d48b1d4d308900f0591fb3bdcf442fdf.woff2?h=ef85e53047102b777e7deb25bab583c9) format('woff2');
font-weight: 800;
font-style: normal;
font-display: swap;

View File

@@ -1,6 +1,6 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-95e85857855fec865b6c71369458c398.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-95e85857855fec865b6c71369458c398.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -9,7 +9,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-aaa666d4a428e7251998747fecc78290.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-aaa666d4a428e7251998747fecc78290.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -18,7 +18,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-78b0a85baaa30f24beb648328eafa7d2.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-78b0a85baaa30f24beb648328eafa7d2.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -27,7 +27,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-61d49d1448f17f5c304c64dcd7e21de6.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-61d49d1448f17f5c304c64dcd7e21de6.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -36,7 +36,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-b97d58e7110272ce3bd9c10ea779a9f2.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-b97d58e7110272ce3bd9c10ea779a9f2.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -45,7 +45,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-75740ec0c715f6b2a4a5d6d5224b0913.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-75740ec0c715f6b2a4a5d6d5224b0913.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -54,7 +54,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-a6b0039aa2236f69d4b63042a8f3769a.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-a6b0039aa2236f69d4b63042a8f3769a.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -63,7 +63,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-8c179a95e52d0e855e33be00ed141e46.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-8c179a95e52d0e855e33be00ed141e46.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -72,7 +72,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-f020d8a91fea76d306428e8877dcc7d6.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-f020d8a91fea76d306428e8877dcc7d6.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -81,7 +81,7 @@
@font-face {
font-family: 'Open Sans';
src: url(/assets/fonts/Open%20Sans-34eb5b5918b88fb910da76a70e512615.woff2?h=b35fe44580a9487b7d79edaefb010eea) format('woff2');
src: url(/assets/fonts/Open%20Sans-34eb5b5918b88fb910da76a70e512615.woff2?h=4afd515aa4663edcfb6121d868bc7f5a) format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;

View File

@@ -1,77 +1,105 @@
let notValue = true;
let andValue = false;
let orValue = false;
let input1 = false;
let input2 = false;
let inputs = {
input1: false,
input2: false
};
const pageHeading = document.getElementById("pageHeading")?.textContent || "";
let gateValue = false;
// **Toggle any gate input (e.g., input1, input2, or NOT gate)**
function toggleGate(gateType) {
const gateKey = gateType === 'NOT' ? 'NotGate' : `Input${gateType}`;
const gateSwitch = document.getElementById(`swt${gateKey}`);
const isActive = gateType === '1' ? input1 : gateType === '2' ? input2 : notValue;
const newValue = !isActive;
if (gateType === '1') input1 = newValue;
if (gateType === '2') input2 = newValue;
if (gateType === 'NOT') notValue = newValue;
gateSwitch?.classList.toggle('btnActive', newValue);
updateGates();
// ** Toggle input (handles both input1 and input2) **
function toggleInput(inputNumber) {
const inputKey = `input${inputNumber}`;
inputs[inputKey] = !inputs[inputKey];
updateInputState(`swtInput${inputNumber}`, inputs[inputKey]);
updateGate();
}
// **Update AND, OR, and NOT gates based on the current input state**
function updateGates() {
if (pageHeading === "AND Gate") updateGate('AndGate', input1 && input2);
if (pageHeading === "OR Gate") updateGate('OrGate', input1 || input2);
if (pageHeading === "NOT Gate") updateGate('NotGate', !notValue);
// ** Update the gate's state based on the current inputs and gate type **
function updateGate() {
const pageHeading = document.getElementById("pageHeading").textContent;
gateValue = evaluateGate(pageHeading);
updateGateLight(pageHeading, gateValue);
}
// **Toggle the output bulb for a gate (e.g., AndGate, OrGate, or NotGate)**
function updateGate(gateName, isActive) {
const bulb = document.getElementById(`blb${gateName}`);
if (!bulb) return;
// ** Evaluate the gate logic **
function evaluateGate(pageHeading) {
const { input1, input2 } = inputs;
bulb.classList.toggle('poweredOn', isActive);
bulb.classList.toggle('poweredOff', !isActive);
if (gateName === 'AndGate') andValue = isActive;
if (gateName === 'OrGate') orValue = isActive;
switch (pageHeading) {
case "AND Gate":
return input1 && input2;
case "OR Gate":
return input1 || input2;
case "NOT Gate":
return !input1; // NOT gate only uses Input1
case "NAND Gate":
return !(input1 && input2); // Correct NAND logic
case "NOR Gate":
return !(input1 || input2);
case "XOR Gate":
return input1 !== input2; // XOR is true if inputs are different
case "XNOR Gate":
return input1 === input2; // XNOR is true if inputs are the same
default:
console.error("Unknown Gate Type");
return false;
}
}
// **Reset the gate to its default state**
// ** Update the lightbulb based on the gate's value **
function updateGateLight(pageHeading, value) {
const lightBulbId = getLightBulbId(pageHeading);
const lightBulb = document.getElementById(lightBulbId);
if (lightBulb) {
lightBulb.classList.toggle("poweredOn", value);
lightBulb.classList.toggle("poweredOff", !value);
}
}
// ** Get the correct lightbulb ID based on the gate type **
function getLightBulbId(pageHeading) {
switch (pageHeading) {
case "AND Gate":
return "blbAndGate";
case "OR Gate":
return "blbOrGate";
case "NOT Gate":
return "blbNotGate";
case "NAND Gate":
return "blbNandGate";
case "NOR Gate":
return "blbNorGate";
case "XOR Gate":
return "blbXorGate";
case "XNOR Gate":
return "blbXnorGate";
default:
console.error("Unknown Gate Type");
return null;
}
}
// ** Update the toggle switch to reflect its active/inactive state **
function updateInputState(switchId, isActive) {
const toggleSwitch = document.getElementById(switchId);
if (toggleSwitch) {
toggleSwitch.classList.toggle("btnActive", isActive);
}
}
// ** Reset the gate to its default state **
function resetGate() {
if (pageHeading === "AND Gate" || pageHeading === "OR Gate") {
resetInput('1');
resetInput('2');
} else if (pageHeading === "NOT Gate") {
resetNotGate();
}
updateGates();
}
inputs.input1 = false;
inputs.input2 = false;
updateInputState("swtInput1", inputs.input1);
updateInputState("swtInput2", inputs.input2);
// **Reset the inputs for Input1 or Input2**
function resetInput(inputNumber) {
if (inputNumber === '1') input1 = false;
if (inputNumber === '2') input2 = false;
const pageHeading = document.getElementById("pageHeading").textContent;
const switchElement = document.getElementById(`swtInput${inputNumber}`);
if (switchElement) switchElement.classList.remove('btnActive');
}
// **Reset the NOT gate to its default state**
function resetNotGate() {
notValue = false; // NOT Gate logic is inverted, so this is "off" input
const bulb = document.getElementById("blbNotGate");
const switchElement = document.getElementById("swtNotGate");
if (bulb) {
bulb.classList.add('poweredOn'); // Light should be on
bulb.classList.remove('poweredOff');
}
if (switchElement) {
switchElement.classList.remove('btnActive'); // Button should be off (inactive)
if (pageHeading === "NOT Gate") {
// For NOT Gate, the light should be on by default
gateValue = true;
updateGateLight(pageHeading, gateValue);
} else {
updateGate();
}
}