A comprehensive platform for creating, visualizing, and simulating Turing Machines with AI-powered optimization and natural language understanding.
- Natural Language Processing: Convert natural language descriptions into Turing Machine definitions
- Intelligent Problem Analysis: AI analyzes problems and generates appropriate machine configurations
- Smart State Generation: Automatically creates optimal states and transitions for specific operations
- Operation Recognition: Supports binary arithmetic, string operations, pattern matching, and more
- Real-time Visualization: Step-by-step execution with visual tape representation
- Multiple Operations: Support for addition, multiplication, subtraction, palindrome checking, string reversal, and pattern matching
- User-Friendly Interface: Intuitive Swing-based GUI with operation selection and input fields
- Detailed Execution Log: Complete step-by-step solution with tape content and state transitions
- Auto-Solve Mode: Automatic execution with comprehensive logging
- Frontend: Next.js React application with modern UI
- Middleware: Express.js server handling API routing and WebSocket connections
- Java Backend: Core Turing Machine simulation engine with HTTP server
- AI Service: TypeScript-based AI service for natural language processing
- Tape Management: Dynamic tape with configurable alphabet and blank symbols
- State Machine: Complete state management with transitions and halting conditions
- Step-by-Step Execution: Detailed simulation with transition logging
- Error Handling: Comprehensive validation and error reporting
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Middleware β β Java Backend β β AI Service β
β (Next.js) βββββΊβ (Express) βββββΊβ (HttpServer) βββββΊβ (TypeScript) β
β Port: 3000 β β Port: 5001 β β Port: 8080 β β Port: 3001 β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Node.js (v18+)
- Java JDK 17+
- Maven 3.6+
- Git
-
Clone the repository
git clone https://github.com/12asascoder/TURING-MACHINE.git cd TURING-MACHINE -
Start all services
./start.sh
-
Access the application
- Frontend: http://localhost:3000
- API: http://localhost:5001
- Java Backend: http://localhost:8080
- AI Service: http://localhost:3001
-
Install dependencies
# Frontend cd frontend && npm install # Middleware cd server && npm install # AI Service cd ai-service && npm install # Java Backend cd backend-java && mvn clean compile
-
Start services individually
# Terminal 1 - Java Backend cd backend-java && mvn exec:java -Dexec.mainClass=com.turingmind.Main # Terminal 2 - AI Service cd ai-service && npm run dev # Terminal 3 - Middleware cd server && npm run dev # Terminal 4 - Frontend cd frontend && npm run dev
- Open the application at http://localhost:3000
- Click "AI Assistant" to access the problem-solving interface
- Enter a problem in natural language, such as:
- "Multiply 101 by 110"
- "Check if 10101 is a palindrome"
- "Reverse the string 'hello'"
- "Find pattern 101 in 110101"
- Click "Generate Machine" to create the Turing Machine
- Java GUI opens automatically with the generated machine
- Select operation type and enter input in the GUI
- Execute step-by-step or use auto-solve mode
- Binary Arithmetic: Addition, multiplication, subtraction
- String Operations: Reversal, palindrome checking
- Pattern Matching: Finding patterns in strings
- Custom Operations: Extensible for new problem types
POST /solveProblem- Generate Turing Machine from natural languagePOST /showGUI- Open Java GUI with machineGET /health- Health check
POST /simulate- Run Turing Machine simulationPOST /analyze- Analyze machine propertiesPOST /validate- Validate machine definitionPOST /showGUI- Launch GUI windowGET /health- Health check
POST /solveProblem- AI problem analysis and machine generationGET /health- Health check
Create .env files in respective directories:
server/.env
PORT=5001
CORS_ORIGIN=http://localhost:3000
JAVA_BACKEND_URL=http://localhost:8080
AI_SERVICE_URL=http://localhost:3001
ai-service/.env
PORT=3001
frontend/.env.local
NEXT_PUBLIC_API_URL=http://localhost:5001
NEXT_PUBLIC_WS_URL=ws://localhost:5001
- Start all services using
./start.sh - Open browser to http://localhost:3000
- Test AI Assistant:
- Enter: "multiply 101 by 110"
- Click "Generate Machine"
- Verify Java GUI opens
- Test step-by-step execution
- Test different operations:
- Binary addition: "add 101 and 110"
- Palindrome: "check if 10101 is palindrome"
- String reversal: "reverse abc"
# Check all services
curl http://localhost:3000 # Frontend
curl http://localhost:5001/health # Middleware
curl http://localhost:8080/health # Java Backend
curl http://localhost:3001/health # AI ServiceTURING-MACHINE/
βββ frontend/ # Next.js React application
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API and WebSocket services
β β βββ pages/ # Next.js pages
β βββ package.json
βββ server/ # Express.js middleware
β βββ src/
β β βββ controllers/ # API controllers
β β βββ services/ # Backend services
β β βββ middleware/ # Express middleware
β β βββ types/ # TypeScript types
β βββ package.json
βββ ai-service/ # AI processing service
β βββ src/
β β βββ services/ # AI services
β β βββ types/ # TypeScript types
β β βββ index.ts # Service entry point
β βββ package.json
βββ backend-java/ # Java simulation engine
β βββ src/main/java/com/turingmind/
β β βββ Main.java # HTTP server
β β βββ TuringMachine.java
β β βββ Simulator.java
β β βββ TuringMachineGUI.java
β β βββ ... # Other Java classes
β βββ pom.xml
βββ start.sh # Platform startup script
βββ README.md
- AIAssistant: Main interface for problem input and machine generation
- TuringMachineVisualizer: Visual representation of machines
- SimulationControls: Execution controls and step-by-step simulation
- Main: HTTP server with REST API endpoints
- TuringMachine: Core machine definition and validation
- Simulator: Step-by-step execution engine
- TuringMachineGUI: Swing-based visualization interface
- Tape: Dynamic tape management with snapshots
- ProblemSolvingService: Natural language to machine conversion
- OptimizationService: Machine optimization algorithms
- AnalysisService: Machine property analysis
- Real-time simulation updates
- Live tape visualization
- Step-by-step execution streaming
- State reduction algorithms
- Transition optimization
- Performance analysis
- Plugin system for new operations
- Custom machine types
- API for third-party integrations
- Port conflicts: Kill existing processes with
pkill -9 -f "turingmind" - Java backend not starting: Ensure JDK 17+ is installed and Maven dependencies are resolved
- GUI not opening: Check Java backend is running on port 8080
- AI service errors: Verify TypeScript compilation and dependencies
# Check running processes
ps aux | grep -E "(turingmind|java|node)"
# Check port usage
lsof -i :3000 # Frontend
lsof -i :5001 # Middleware
lsof -i :8080 # Java Backend
lsof -i :3001 # AI Service
# View logs
tail -f server/logs/app.log- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m "Add feature" - Push to branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with modern web technologies and Java
- AI-powered problem solving capabilities
- Comprehensive Turing Machine simulation engine
- Real-time visualization and interaction
For issues and questions:
- Create an issue on GitHub
- Check the troubleshooting section
- Review the API documentation
TuringMind - Where AI meets Turing Machine theory! π§ π€