My Projects

Showcasing technical skills and creative solutions

Projects Overview

This portfolio showcases two significant projects that demonstrate my technical skills across different domains. The Advanced Tic-Tac-Toe game represents my expertise in cross-platform mobile development using Flutter, featuring an adaptive AI system and modern UI design. The Snake Game AI project showcases my capabilities in machine learning and reinforcement learning, implementing sophisticated neural networks and automated benchmarking systems.

Technologies & Libraries Used

Last updated:

Advanced Tic-Tac-Toe

A modern, cross-platform implementation of Advanced Tic Tac Toe built with Flutter. This isn't your ordinary tic-tac-toe - it's a strategic game where you play on a 3x3 grid of tic-tac-toe boards! The game features an adaptive AI system, beautiful UI with dark theme and neon accents, and comprehensive statistics tracking.

A modern, cross-platform implementation of Advanced Tic Tac Toe built with Flutter. This isn't your ordinary tic-tac-toe - it's a strategic game where you play on a 3x3 grid of tic-tac-toe boards! The game features an adaptive AI system, beautiful UI with dark theme and neon accents, and comprehensive statistics tracking.

🎮 Try the Game Right Here!

The game is fully playable in this window.

Project Overview

  • Platform: Cross-platform application (Android, iOS, Web, Windows, macOS, Linux)
  • Technology Stack: Flutter 3.4.3+, Dart, Material Design
  • Development Status: Active development - preparing for Play Store and App Store release
  • Deployment: Automated GitHub Actions deployment to GitHub Pages

Key Features

  • Advanced Gameplay: Play on a 3x3 grid of tic-tac-toe boards with strategic depth
  • Multiple Game Modes: AI opponent with adaptive difficulty and pass-and-play multiplayer
  • Smart AI System: Computer opponent that adapts to your skill level (difficulty 0-100)
  • Beautiful UI: Modern dark theme with neon blue and orange accents
  • Animated Background: Floating grid animations for visual appeal
  • Statistics Tracking: Persistent win/loss/draw statistics with SharedPreferences
  • Cross-Platform: Consistent experience across all platforms

Technical Implementation

The application is built using Flutter's modern widget system with a focus on clean architecture and maintainable code. The core game logic is implemented in a dedicated game_logic.dart file that handles all board state management, move validation, and win condition checking. This modular approach ensures that the game logic is completely separated from the UI layer, making it easy to test and modify.

State management is handled through Flutter's built-in StatefulWidget system, which provides efficient re-rendering and state persistence. The game maintains multiple state variables including the current board configuration, active player, game status, and AI difficulty level. Data persistence is implemented using SharedPreferences to store player statistics, game preferences, and AI learning progress across app sessions.

The UI architecture follows a modular design pattern with custom widgets for each game component. The main game board is composed of nine smaller tic-tac-toe boards, each implemented as a separate widget that can be individually updated. This approach allows for smooth animations, efficient rendering, and easy customization of the visual appearance.

Deployment is fully automated using GitHub Actions, which builds the Flutter web application and deploys it to GitHub Pages on every push to the main branch. This ensures that the live demo is always up-to-date with the latest features and bug fixes.

AI System

The AI system implements an adaptive difficulty algorithm that provides a dynamic challenge level based on player performance. The difficulty ranges from 0 (easiest) to 100 (hardest), with the AI adjusting its strategy accordingly. At lower difficulty levels, the AI makes more random moves, while at higher levels, it employs sophisticated game theory principles.

The AI's decision-making process follows a hierarchical approach: first, it evaluates all possible moves for immediate winning opportunities. If no winning move is available, it looks for moves that block the opponent from winning. Finally, if neither condition is met, it selects moves based on the current difficulty level - either strategically or randomly.

The learning system continuously adapts the AI's difficulty based on game outcomes. When the AI wins, the difficulty increases slightly, making the game more challenging. Conversely, when the player wins, the difficulty decreases, ensuring the game remains accessible and enjoyable. This creates a personalized gaming experience that grows with the player's skill level.

The move evaluation algorithm uses a weighted scoring system that considers board position, potential future moves, and strategic value. This allows the AI to think several moves ahead and make decisions that maximize its chances of winning while maintaining the appropriate challenge level for the player.

Challenges & Solutions

Complex Game Logic Implementation: The biggest challenge was implementing the intricate game logic for a 3x3 grid of tic-tac-toe boards. Traditional tic-tac-toe algorithms don't scale well to this complexity. I solved this by developing a modular approach where each small board is treated as a separate entity with its own state, while maintaining a global game state that tracks the overall progress. This separation of concerns made the code more maintainable and easier to debug.

Adaptive AI Development: Creating an AI that provides appropriate challenge levels was particularly challenging. A purely random AI would be too easy, while a perfect AI would be unbeatable. I implemented a difficulty-based move selection system that uses weighted randomization. The AI evaluates all possible moves and assigns probabilities based on the current difficulty level, ensuring that players of all skill levels can enjoy the game.

Cross-Platform Compatibility: Ensuring consistent performance and user experience across all platforms required careful consideration of platform-specific limitations. I used Flutter's responsive design system and Material Design principles to create a unified experience. The game automatically adapts its layout and interaction patterns based on the target platform, whether it's touch-based mobile devices or mouse-driven desktop environments.

What I Learned: This project deepened my understanding of Flutter's widget system, cross-platform development, and game AI implementation. I gained experience in creating responsive UIs, implementing complex game logic, automated deployment with GitHub Actions, and building adaptive AI systems. The project also taught me about state management, data persistence, and user experience design for mobile applications.

Repository: GitHub Link

Snake Game AI

This project is an enhanced clone of Patrick Loeber's popular Snake-AI tutorial. The goal is to experiment with more sophisticated reinforcement-learning techniques, richer game state representations, and a fully reproducible training / benchmarking pipeline.

This project is an enhanced clone of Patrick Loeber’s popular Snake-AI tutorial. The goal is to experiment with more sophisticated reinforcement-learning techniques, richer game state representations, and a fully reproducible training / benchmarking pipeline.

Project Overview

  • Technology Stack: Python 3.10, PyTorch 2.x, CUDA, Scikit-learn, pygame, NumPy, Matplotlib
  • Algorithms: Deep Q-Learning (baseline) and an Enhanced DQN with deeper CNN layers & reward shaping
  • Training Infrastructure: GPU acceleration with CUDA + multiprocessing for live plotting
  • Project Status: Active — benchmarking and analysis phase in progress

Key Features

  • Two distinct agents: the original agent.py (Patrick’s logic) and smarter_agent.py with a wider state space and deeper network
  • Interactive popup to choose train / debug mode, game speed, and number of games for every run
  • Automatic, sequential naming of models, plots, and CSV logs for hassle-free benchmarking
  • Live training graphs rendered in a separate process for smooth visualisation
  • Automated scripts to train both agents and run head-to-head comparison over 100 games
  • Consistent 750 × 750 board size to keep evaluation fair and comparable
  • Optional human-play mode for collecting supervised-learning datasets (coming soon)

Technical Implementation

The core environment (game.py) models the Snake world and exposes a minimal API reminiscent of OpenAI Gym. Each agent receives a flattened state vector comprising danger bits, current direction, and food location, enabling GPU-friendly batch processing. A fixed-size replay buffer stores experience tuples which are sampled uniformly to break temporal correlations during training.

The baseline agent mirrors Patrick’s original DQN architecture: a shallow feed-forward network trained with Mean-Squared Error on the temporal-difference target. The smarter agent introduces a deeper four-layer network, a richer state (including snake length trend and relative tail position) and a shaped reward that penalises idle wandering while encouraging shorter paths to food. Both agents share a common Trainer helper that handles optimiser steps, target-network synchronisation, and gradient clipping.

Every experiment launches through a small Tkinter dialog where you specify debug/train mode, game speed, and desired game count. In debug mode a separate plot_process.py is spawned, periodically reading a queue and drawing live score curves without blocking the GPU training loop. All artefacts — models (.pth), plots (.png), and CSV logs — are saved with incrementing filenames so multiple runs never overwrite each other.

Challenges & Solutions

Stability of Deeper Networks : The smarter agent’s deeper architecture initially suffered from exploding gradients. Gradient-clipping at 1.0 and a decaying learning-rate scheduler stabilised training while preserving learning capacity.

Reward Hacking : A naïve reward shaping led the agent to loop endlessly without seeking food. Introducing a small time-penalty and a distance-to-food heuristic guided the policy towards more purposeful exploration.

Reproducible Benchmarking : Saving models / logs with unique sequential names and using a deterministic torch.manual_seed pipeline ensures that experiments can be repeated and compared objectively.

Benchmarking & Analysis

Automated scripts (train_both_models.py & compare_models.py) train each agent for 10 000 games and then run a 100-game head-to-head evaluation. Detailed plots and CSV metrics are produced — a concise write-up analysing these results will be added very soon.

What I Learned: Building this project strengthened my understanding of advanced DQN techniques, reward shaping, multiprocessing for real-time visualisation, and reproducible ML experimentation. It also underscored the importance of rigorous benchmarking when claiming improvements over baseline models.

Repository: GitHub Link