π’ DFA-based Smart Building Access Control System
π Description
This project implements a Deterministic Finite Automaton (DFA) based Access Control System for a smart building. Each restricted zone is secured by a π unique sequence of authentication methods, ensuring step-by-step verification. The system validates user authentication and strictly enforces sequence rules, rejecting any incorrect, missing, or extra steps.
Implemented in Python, this project includes:
- π DFA design for each building zone
- π Transition tables for all input symbols and states
- π State diagrams for visualization
- π Test cases covering normal, edge, and invalid inputs
β¨ Features
- π·οΈ Zone-specific access control: Each zone has a predefined authentication sequence
- β Strict sequence enforcement: Access granted only when the exact sequence is followed
β οΈ Error handling: Invalid symbols, wrong order, missing steps, and extra inputs are rejected- π§ Dynamic scalability: Add new zones or authentication methods without major redesign
- π₯οΈ User-friendly interface: Shows authentication symbols and available zones
π Authentication Symbols
| Symbol | Authentication Method |
|---|---|
| C | Card Swipe |
| F | Fingerprint |
| R | Retina Scan |
| S | Face Recognition |
| V | Voice Recognition |
| P | PIN Entry |
| B | Biometric Combo |
| A | Admin Override |
π’ Available Zones
- Lobby
- Server Room
- Laboratory
- Executive Lounge
- Research Wing
- Conference Hall
- Data Center
- Admin Office
π How to Run
- Clone the repository:
git clone https://github.com/YourUsername/DFA_SmartBuildingAccess.git
- Navigate to the project folder:
cd DFA_SmartBuildingAccess - Run the Python program:
python access_control.py
- Follow the on-screen prompts to select a zone and enter the authentication sequence
- Type
exitto quit the program
π₯ Sample Usage
Correct Sequence Example:
Enter Zone Name (or type 'exit' to quit): Lobby
Enter authentication sequence (symbols separated by space, e.g., C F R B): C F R B
β
Access Granted β
Invalid Sequence Example:
Enter Zone Name: Server Room
Enter authentication sequence: C F R B
β Access Denied β
π DFA Design Overview
- States (Q): Represent progress of authentication
- Start State (q0): No authentication done
- Intermediate States: Each represents successful completion of a step
- Accept State: Full sequence completed, access granted
- Reject State (qr): Any invalid input, incorrect order, missing steps, or extra input
- Input Alphabet (Ξ£): {C, F, R, S, V, P, B, A}
π§ͺ Testing
Tested with multiple real-world scenarios:
| Test Case | Zone | Input Sequence | Expected Output | Actual Output | Pass/Fail |
|---|---|---|---|---|---|
| 1 | Lobby | C F R B | β Access Granted | β Access Granted | Pass |
| 2 | Server Room | C F R B | β Access Denied (wrong final step) | β Access Denied | Pass |
| 3 | Laboratory | C F R | β Access Denied (partially complete) | β Access Denied | Pass |
| 4 | Executive Lounge | C F R S P | β Access Denied (extra input) | β Access Denied | Pass |
| 5 | Research Wing | C X B P | β Invalid Symbol β Access Denied | β Invalid Symbol β Access Denied | Pass |
π― Conclusion
This DFA-based smart building access control system ensures secure, deterministic, and scalable authentication for multiple zones. Python implementation provides:
- π Dynamic sequence validation
- π Clear state transitions
- β‘ Robust error handling
It demonstrates a practical application of formal automata theory in modern security systems.