logo

DFA Simulator

DFA Simulator

DFA Simulator

The DFA Simulator is an interactive web application designed to simulate and visualize Deterministic Finite Automata (DFA). This user-friendly tool allows users to create, manipulate, and test DFAs in a visually intuitive environment.

Features

  • Interactive Canvas: A central canvas area for creating and manipulating DFA states.
  • State Creation: Easily create new states by double-clicking on the canvas.
  • Transition Definition: Draw transitions between states and define input values.
  • String Testing: Test DFAs with custom input strings to check for acceptance or rejection.
  • Manual Debugging: Step through the DFA manually to explore state transitions.
  • Example DFAs: Access pre-defined DFA examples for learning and experimentation.
  • Intuitive Interface: User-friendly design for easy navigation and interaction.

Getting Started

To run the DFA Simulator locally:

  1. Clone the repository: git clone https://github.com/your-username/dfa-simulator.git
  2. Open the index.html file in your preferred web browser.

Usage Guide

  1. Creating States:
  • Double-click on the canvas to create a new state.
  • Click and drag to reposition states.
  1. Defining Transitions:
  • Click and drag from one state to another to create a transition.
  • Enter the input value for the transition when prompted.
  1. Testing Strings:
  • Enter an input string in the designated text box.
  • Click the "Test" button to see if the DFA accepts or rejects the string.
  1. Manual Debugging:
  • Use the step-by-step controls to manually traverse the DFA with specific inputs.
  1. Loading Examples:
  • Click on the "Examples" button to load pre-defined DFA configurations.
An example running DFA showing failed and passed test.
An example running DFA showing failed and passed test.

Technical Details

The DFA Simulator is built using the following technologies:

  • HTML5
  • CSS3
  • JavaScript

The application uses a canvas-based rendering system for visualizing the DFA and handles user interactions through event listeners.

Contributing

Contributions to the DFA Simulator project are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive commit messages.
  4. Push your changes to your fork.
  5. Submit a pull request to the main repository.

Please ensure that your code adheres to the existing style and includes appropriate documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.