Skip to content

mind2spirit/wordle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Wordle AI Bot - Flutter Edition

An intelligent AI bot built with Flutter that automatically solves Wordle-like puzzles by connecting to the Wordle API. This project demonstrates advanced problem-solving approaches, clean code architecture, and seamless external service integration.

๐ŸŽฏ Project Overview

The Wordle AI Bot showcases how to build a sophisticated puzzle-solving application using Flutter. It demonstrates:

  • API Integration: Seamless communication with external REST APIs
  • AI Algorithms: Intelligent word selection and pattern analysis
  • Clean Architecture: Well-structured, maintainable code
  • Modern UI: Beautiful Material Design 3 interface
  • State Management: Efficient Flutter state handling
  • Error Handling: Robust error handling and user feedback

โœจ Features

Core Functionality

  • Automatic Puzzle Solving: AI-driven word selection algorithms
  • Multiple Game Modes: Daily puzzles, random words, and custom challenges
  • Real-time API Communication: Live interaction with the Wordle API
  • Performance Tracking: Comprehensive statistics and analytics
  • Responsive Design: Works on all Android device sizes

AI Capabilities

  • Frequency Analysis: Letter frequency-based word scoring
  • Pattern Recognition: Intelligent elimination of impossible words
  • Information Maximization: Words chosen to provide maximum information gain
  • Adaptive Strategy: Adjusts approach based on previous results

User Experience

  • Beautiful Interface: Modern Material Design 3 aesthetics
  • Real-time Feedback: Live updates during solving process
  • Game History: Track performance across multiple sessions
  • Customizable Options: Adjust seeds and game modes (5-letter words only)

๐Ÿ—๏ธ Architecture

Project Structure

lib/
โ”œโ”€โ”€ main.dart                    # Main application entry point
โ”œโ”€โ”€ models/                      # Data models and enums
โ”‚   โ””โ”€โ”€ wordle_models.dart      # Core data structures
โ”œโ”€โ”€ services/                    # Business logic and API communication
โ”‚   โ”œโ”€โ”€ wordle_api_service.dart # API client and HTTP handling
โ”‚   โ”œโ”€โ”€ word_analyzer_service.dart # Word analysis and scoring
โ”‚   โ””โ”€โ”€ wordle_solver_service.dart # Core AI solving logic
โ””โ”€โ”€ (UI components)              # Flutter widgets and screens

Key Components

1. WordleApiService

  • Handles all HTTP communication with the Wordle API
  • Implements proper error handling and timeout management
  • Supports all API endpoints (daily, random, custom)

2. WordAnalyzerService

  • Analyzes word frequency and letter patterns
  • Provides intelligent word scoring algorithms
  • Filters words based on game feedback

3. WordleSolverService

  • Orchestrates the solving process
  • Implements the core AI logic
  • Manages game sessions and state

4. Data Models

  • GuessResult: Individual letter feedback
  • GameSession: Complete game state
  • GameStats: Performance metrics
  • ApiResponse: Generic API response wrapper

๐Ÿš€ Getting Started

Prerequisites

  • Flutter SDK (3.4.0 or higher)
  • Android Studio or VS Code
  • Android device or emulator
  • Internet connection for API access

Installation

  1. Clone or navigate to the project:

    cd wordle_ai_bot
  2. Install dependencies:

    flutter pub get
  3. Run the app:

    flutter run

Running on Android

# Ensure you have an Android device connected or emulator running
flutter devices

# Run the app
flutter run

# Or run specifically on Android
flutter run -d android

๐ŸŽฎ How to Use

1. Choose Game Mode

  • Daily: Solve the daily puzzle
  • Random: Solve a random word (with optional seed)
  • Custom: Solve a specific word of your choice

2. Configure Options

  • Set random seed for reproducible puzzles (Random mode)
  • Enter custom target word (Custom mode)
  • Note: All puzzles use 5-letter words (API limitation)

3. Start Solving

  • Tap "START SOLVING"
  • Watch the AI work in real-time
  • View results and statistics

4. Monitor Progress

  • Real-time solving progress
  • Color-coded feedback for each guess
  • Performance statistics and history

๐Ÿง  AI Algorithm Details

Word Selection Strategy

First Guess

  • Uses high-frequency letters (E, A, R, T, O, I, N, S)
  • Prioritizes words with common letter patterns
  • Examples: "raise", "slate", "crane"

Subsequent Guesses

  • Analyzes feedback to eliminate impossible words
  • Scores remaining words by information gain
  • Considers letter frequency and pattern matching

Pattern Analysis

  • Correct (Green): Letter in right position
  • Present (Yellow): Letter in word, wrong position
  • Absent (Grey): Letter not in word

Scoring Algorithm

Word Score = Letter Frequency + Pattern Bonus + Information Gain
  • Letter Frequency: Based on English language statistics
  • Pattern Bonus: Bonus for common letter combinations
  • Information Gain: Potential to eliminate word candidates

๐Ÿ”Œ API Integration

Endpoints Used

  • GET /daily - Daily puzzle with guess parameter
  • GET /random - Random word puzzle with optional seed
  • GET /word/{word} - Custom word puzzle

Response Format

[
  {
    "slot": 0,
    "guess": "a",
    "result": "absent"
  },
  {
    "slot": 1,
    "guess": "b", 
    "result": "present"
  }
]

Error Handling

  • Network timeout management
  • API error responses
  • Graceful degradation
  • User-friendly error messages

๐Ÿ“Š Performance Metrics

The bot tracks comprehensive statistics:

  • Success Rate: Percentage of puzzles solved
  • Average Guesses: Mean guesses per puzzle
  • Solving Time: Time taken per puzzle
  • Win Streaks: Current and best streaks
  • Guess Distribution: Breakdown by number of guesses

๐ŸŽจ UI/UX Features

Material Design 3

  • Modern color scheme and typography
  • Responsive layout for all screen sizes
  • Smooth animations and transitions
  • Intuitive navigation and controls

Visual Feedback

  • Color-coded guess results
  • Progress indicators during solving
  • Status messages and notifications
  • Interactive game mode selection

Accessibility

  • Clear visual hierarchy
  • Readable typography
  • Touch-friendly controls
  • Screen reader support

๐Ÿ”ง Customization

Modifying the AI

Edit word_analyzer_service.dart to:

  • Change letter frequency weights
  • Add new scoring algorithms
  • Modify word selection strategies

Adding New Word Lists

  • Extend the word list in wordle_solver_service.dart
  • Implement word list loading from files
  • Add support for different languages

UI Customization

  • Modify color schemes in main.dart
  • Add new game modes and options
  • Customize statistics display

๐Ÿšง Error Handling

Network Issues

  • Automatic retry with exponential backoff
  • Graceful timeout handling
  • Offline mode detection

API Errors

  • HTTP status code handling
  • Rate limiting respect
  • User-friendly error messages

Input Validation

  • Word length validation
  • Character set restrictions
  • Game mode validation

๐Ÿ”ฎ Future Enhancements

Planned Features

  • Machine Learning: Train models on historical data
  • Multi-language Support: Solve puzzles in different languages
  • Advanced Analytics: Detailed performance insights
  • Social Features: Share results and compete with friends

Technical Improvements

  • Caching: Local storage for offline play
  • Background Processing: Solve puzzles in background
  • Push Notifications: Daily puzzle reminders
  • Cloud Sync: Cross-device progress synchronization

๐Ÿค Contributing

We welcome contributions! Areas for improvement:

  • Algorithm Optimization: Better word selection strategies
  • Performance: Faster solving algorithms
  • UI/UX: Enhanced user experience
  • Testing: Comprehensive test coverage
  • Documentation: Improved code documentation

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • Wordle API: Provided by wordle.votee.dev
  • Flutter Team: Amazing cross-platform framework
  • Material Design: Beautiful design system
  • Open Source Community: Inspiration and support

๐Ÿ“ž Support

If you encounter issues or have questions:

  • Check the API status at wordle.votee.dev:8000
  • Review the error messages in the app
  • Check your internet connection
  • Ensure Flutter is properly configured

Happy Wordle Solving! ๐ŸŽฏโœจ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors