Skip to content

azhann-01/AI-TicArena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎮 TicArena AI Edition

A Java-based 5×5 Tic Tac Toe game developed using Java Swing, JDBC, and MySQL. TicArena AI Edition features secure user authentication, persistent player statistics, a leaderboard system, and a smart AI opponent capable of detecting winning opportunities and blocking player threats.


🚀 Features

👤 User Authentication

  • User Registration System
  • Secure Login Functionality
  • MySQL Database Integration
  • Persistent User Records

🎯 Gameplay

  • 5×5 Tic Tac Toe Board
  • Turn-Based Gameplay
  • Win Detection System
  • Draw Detection System
  • Restart Game Functionality
  • Back-to-Lobby Navigation

🤖 Smart AI Opponent

The AI follows a decision-making strategy:

  1. Checks for a winning move and plays it immediately.
  2. Detects and blocks potential player wins.
  3. Chooses a valid move when no immediate threat exists.

This creates a challenging gameplay experience while maintaining efficient performance.

📊 Statistics & Leaderboard

  • Win Tracking
  • Loss Tracking
  • Draw Tracking
  • Score Calculation
  • Dynamic Leaderboard
  • Persistent Statistics Stored in MySQL

🛠 Technologies Used

  • Java
  • Java Swing
  • JDBC
  • MySQL
  • Git
  • GitHub

📸 Screenshots

Welcome Screen

Welcome

Login Screen

Login

Registration Screen

Register

Lobby

Lobby

Game Board

Game Board

Leaderboard

Leaderboard


🗄 Database Schema

users

Column Description
id Unique User ID
username Player Username
password User Password
score Total Score
wins Number of Wins
losses Number of Losses
draws Number of Draws
created_at Account Creation Time

🏗 Project Architecture

TicArena
│
├── gui
│   ├── WelcomeFrame
│   ├── LoginFrame
│   ├── RegisterFrame
│   ├── LobbyFrame
│   ├── GameFrame
│   └── LeaderboardFrame
│
├── database
│   ├── DBConnection
│   └── UserDAO
│
└── main
    └── Main

▶ How to Run

  1. Clone the repository:
git clone <repository-url>
  1. Create the MySQL database.
CREATE DATABASE ticarena;
  1. Configure database credentials in:
src/database/DBConnection.java
  1. Compile the project.
javac -cp "lib/*" -d bin src/database/*.java src/gui/*.java src/main/*.java
  1. Run the application.
java -cp "bin;lib/*" main.Main

🎓 Learning Outcomes

This project helped strengthen understanding of:

  • Object-Oriented Programming (OOP)
  • Java Swing GUI Development
  • JDBC Database Connectivity
  • SQL Query Handling
  • Event-Driven Programming
  • Game Logic Design
  • Git & GitHub Version Control

🔮 Future Enhancements

  • Multiple AI Difficulty Levels
  • Online Multiplayer Support
  • Friend Match System
  • Player Profiles
  • Sound Effects and Animations
  • Advanced Analytics Dashboard

👨‍💻 Author

Md Azhan Sarfaraz B.Tech Computer Science & Engineering Passionate about Software Development, Artificial Intelligence, and Problem Solving.

About

AI-powered 5×5 Tic Tac Toe game built with Java Swing, JDBC, and MySQL featuring authentication, leaderboard tracking, and a smart AI opponent.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages