VISVESWARAYA TECHNOLOGICAL UNIVERSITY
Jnana Sangama, Belagavi-590018
A Mini-Project Report
on
"Tic Tac Toe Using Java”
Submitted on partial fulfillment of academic requirement of 4th semester JAVA laboratory
BACHELOR OF ENGINEERING
In
Department of Computer Science and Engineering
Submitted By
Anusha Anand-1TE24CS059
Under The Guidance of
Mrs. Aruna N
Mrs. Shilpa M
Mrs. Manjula S D
Mrs. Renita B M
Assistant Professor
Computer Science
Department of Computer Science and Engineering
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
(Autonomous Institute Affiliated to VTU)
Avalahalli, Yelahanka, Bengaluru –
560119.
2025-2026
VISVESWARAYA TECHNOLOGICAL UNIVERSITY
Jnana Sangama, Belagavi-590018
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
(Autonomous Institute Affiliated to VTU)
Avalahalli, Yelahanka, Bengaluru – 560064.
Department of Computer Science and Engineering
CERTIFICATE
This is to certify that the MC Mini-Project entitled “Tic Tac Toe Deluxe Using Java
Swing, JDBC, SQLite” has been carried out by Anusha Anand-1TE24CS059 a bonafide
student of BMS Institute of Technology and Management, Autonomous Institute Affiliated
to VTU, in partial fulfillment for IV semester B.E project work in the Department of
Computer Science and Engineering in Visvesvaraya Technological University ,
Belagavi , during the academic year 2025-2026 (Even Semester). It is certified that all
corrections/suggestions indicated for assessment have been incorporated in the report
deposited in department library. The project report has been approved as it satisfies the
academic requirements in respect of Mini-Project work prescribedfor the said degree.
Signature of the Guide Signature of the Head (Division
1) Mrs. Aruna N Dr. Mahesh G
Assisstant Professor Professor & Head (Division 1)
CSE Dept., BMSIT&M CSE Dept., BMSIT&M
DECLARATION
We hereby declare that the mini project titled “Tic-Tac-Toe Deluxe: A Hybrid Web and Desktop
Application using Java, JDBC and SQLite” submitted as part of the academic requirements is an
original work carried out by our team under the guidance and supervision of our faculty guide. We
confirm that the project work presented in this report has been developed using our own knowledge,
implementation techniques, and programming skills.
The information, interactive web interface, Java Swing administrative modules, SQLite database
implementation, JDBC connectivity, SQL queries, and application modules included in this project are
genuine to the best of our knowledge and belief. We further declare that this report has not been
submitted either fully or partially to any other institution or university for the award of any degree,
diploma, or certificate. This project has helped us gain practical knowledge of Java programming,
Spring Boot web architecture, database management systems, Swing GUI development, JDBC
connectivity, and hybrid application development.
ACKNOWLEDGEMENT
We express our sincere gratitude to our institution for providing us with the opportunity and facilities to
successfully complete this mini project titled “Student Management System Using Java Swing and
MYSql”. We would like to convey our heartfelt thanks to our faculty guide for the valuable guidance,
encouragement, and continuous support throughout the development of this project. Their suggestions
and motivation helped us complete the project successfully. We also extend our gratitude to the Head of
the Department and all faculty members for their support and encouragement during the course of this
project work. Finally, we express our sincere thanks to our friends and family members for their constant
encouragement and moral support throughout the completion of this project.
Figure No. Figure Name
1 Player dashboard and frontpage
2 Database Image
3 Flowchart
4 Tic Tac Toe code snippets
5 Admin Dashboard, Game Frontend
ABSTRACT
The Tic-Tac-Toe Deluxe project is a hybrid digital system that combines modern web architecture
with traditional Java desktop components. This application features an interactive web-based
gaming interface built with JavaSpring Boot and a separate administrative dashboard developed
using Java Swing. Connectivity to the persistent SQLite database is established via JDBC,
enabling real-time tracking of player statistics and automated leaderboard management. The project
demonstrates a robust implementation of the Model-View-Controller (MVC) pattern, effectively
bridging the gap between web-based accessibility and desktop-based data management.
Chapter No. Chapter Title Page No.
Abstract ii
Acknowledgement iii
Declaration iv
List of Figures v
List of Tables vi
Chapter 1 Introduction 1
1.1 Background 2
1.2 Problem Definition 3
1.3 Objectives 4
1.4 Scope of the Project 5
Chapter 2 System Requirements and Specifications 6
2.1 Hardware Requirements 7
2.2 Software Requirements 8
2.3 Functional Requirements 9
2.4 Non-Functional Requirements 10
Chapter 3 System Design 11
3.1 System Architecture 12
3.2 Database Design 13
3.3 Flowchart 14
3.4 Working Principle 15
Chapter 4 Implementation 16
4.1 Java Program Implementation 17
4.2 MYSql Database Connectivity 18
4.3 Program Features 19
Chapter 5 Testing 20
5.1 Testing Strategy 20
5.2 Unit Testing 20
Chapter 6 Results and Discussion 21
6.1 Results 21
CHAPTER 1: INTRODUCTION
1.1 Background
Digital gaming and interactive entertainment play a significant role in modern software development
education. Traditional manual methods of playing strategy games are limited by physical presence and the
inability to track long-term performance records. Managing player statistics, game history, and
competitive leaderboards manually is time-consuming, inefficient, and highly prone to human error. With
the increasing digitalization of classic pastimes, there is a growing need for automated systems capable of
facilitating gameplay while managing data efficiently.
Java-based applications provide a robust and reliable platform for creating such systems, offering
sophisticated graphical user interfaces and seamless database integration. While traditional desktop
applications were the standard, the modern trend has shifted towards web-based Java applications that
offer greater accessibility across different devices. The Tic-Tac-Toe Deluxe system is developed using
Java Spring Boot and an SQLite database to provide a lightweight, high-performance, and user-friendly
solution for digital entertainment. JDBC (Java Database Connectivity) is utilized to establish a stable
communication bridge between the interactive frontend and the persistent backend database. The
application performs critical operations such as real-time game state management, automated AI decision-
making, and persistent storage of player wins, losses, and draws to maintain a competitive ranking system
effectively.
1.2 Problem Definition
The goal was to design and implement a Java application that features an attractive and user-friendly
interface with effective look-and-feel enhancements. The requirements included:
- Use of Java Swing or similar Java-based UI (adapted to Web for this project).
- Connection to a DBMS using JDBC.
- A robust and well-structured solution.
- Implementation of game logic and data persistence.
1.3 Objectives
The primary objectives of the Tic-Tac-Toe Deluxe project are:
- To develop a modern web-based interactive application using Java Spring Boot.
- To establish stable database connectivity using JDBC (Java Database Connectivity).
- To store and manage player statistics and leaderboards using an SQLite database.
- To perform persistence operations effectively (inserting and updating records).
- To create an attractive and user-friendly graphical interface with responsive design.
- To understand the practical implementation of Java-based web backend and database integration.
1.4 Scope of the Project
The scope includes the development of a web-based interactive gaming tool capable of handling
player metrics such as name, wins, losses, and draws. It encompasses the frontend responsive UI
design, backend server-side implementation using Spring Boot, and the logic required for data
synchronization between the gameplay and the persistent databaseThe project includes:
• Modern Web frontend development (HTML/CSS/JS)
• SQLite database creation and schema management
• JDBC connectivity using Spring JdbcTemplate
• Persistence operation implementation (Upsert logic)
• Leaderboard display using dynamic HTML tablesThe project is suitable for demonstrating modern
Java web development, game logic implementation, and beginner-level relational database
management applications.
CHAPTER 2: SYSTEM REQUIREMENTS AND SPECIFICATIONS
2.1 Hardware Requirements
Component Specifications Quantity Purpose
Processor Intel Core i3 / i5 or 1 Application
equivalent processing
RAM 8 GB RAM 1 System execution
Storage 256 GB SSD / HDD 1 Database and file
storage
2.2 Software Requirements
Software Purpose Version Platform
Java Development Development JDK 17 or higher Windows / Linux
Kit environment
MySQL Server Backend data storage 8.0 or higher Cross-platform
VSCODE Integrated Latest Windows
Development
Environment
2.3 Functional Requirements
Functional requirements define the specific operations and capabilities that the system must perform
to meet project objectives:
• Add, View, and Delete student records.
• Update existing student information.
• Implement secure admin login and authentication.
• Provide search and filter functionality by name, department, or email.
• Establish persistent database connectivity via JDBC
CHAPTER 3: SYSTEM DESIGN
3.1 SYSTEM ARCHITECTURE
The system follows the Model-View-Controller (MVC) architectural pattern. The Model (GameStat
& GameRepository) handles data logic and database interaction, the View ([Link]) represents the
Web-based UI components, and the Controller (GameController) manages the communication
between the UI and the database via JDBC. This ensures a clean separation of concerns and easier
maintenance.
3.2 DATABASE DESIGN
Database Name: [Link] (SQLite)
Table Name: player_stats
Field Type Description
id INTEGER Primary Key (Auto-
increment)
player_name TEXT Unique Player Name
wins INTEGER Total Games Won
losses INTEGER Total Games Lost
draws INTEGER Total Games Drawn
3.3 SQL QUERIES USED
Create Table Query:
CREATE TABLE IF NOT EXISTS player_stats (
id INTEGER PRIMARY KEY AUTOINCREMENT,
player_name TEXT UNIQUE,
wins INTEGER DEFAULT 0,
losses INTEGER DEFAULT 0,
draws INTEGER DEFAULT 0);
Upsert (Insert/Update) Queries:
-- Check existence
SELECT COUNT(*) FROM player_stats WHERE player_name = ?;
-- New Player
INSERT INTO player_stats (player_name, wins, losses, draws) VALUES (?, 0, 0,
0);
-- Update Record (e.g., for a win)
UPDATE player_stats SET wins = wins + 1 WHERE player_name = ?;
Select Query (Leaderboard):
SELECT player_name, wins, losses, draws FROM player_stats ORDER BY wins DESC
LIMIT 10;
3.4 FLOWCHART
The application starts by initializing the web-based graphical user interface and establishing a database
connection via JDBC. User input is accepted through a name modal. During gameplay, the JavaScript
engine manages the state. Upon a game conclusion (Win/Loss/Draw), the application sends a request
to the backend, which performs a database update using SQL queries. Finally, the updated leaderboard
is fetched and displayed dynamically on the dashboard
CHAPTER 4: IMPLEMENTATION
4.1 IMPLEMENTATION DETAILS
The implementation of the Tic-Tac-Toe Deluxe system was a multi-stage process involving backend
server-side logic, database persistence scripts, and frontend client-side interactivity. Each component was
carefully crafted to ensure that the final product was not only functional but also adhered to modern
software engineering standards.
4.1.1 Backend Implementation (Java, Spring Boot & JDBC)
The backend was developed using Java 17, taking advantage of modern language features to keep the
code concise and maintainable.
1. Data Modeling with Java Records: We utilized the record keyword introduced in recent Java
versions to define the GameStat class. This provides an immutable, transparent carrier for player
data. By using a record, we automatically gain equals(), hashCode(), and toString() methods, as
well as a canonical constructor, which reduces boilerplate code and makes the data layer much
cleaner.
2. The Persistence Layer (GameRepository): The core of the database interaction resides in the
GameRepository. We chose JdbcTemplate for its balance between raw SQL power and
automated resource management. The implementation includes:
a. Upsert Logic: When a game result is reported, the repository first checks if the player
exists in the SQLite database. If not, it performs an INSERT. This ensures that new
players are added dynamically without requiring a separate registration step.
b. Leaderboard Retrieval: A specific SQL query (SELECT ... ORDER BY wins DESC
LIMIT 10) is used to fetch the top performers, demonstrating how JDBC can be used to
perform filtered and sorted data retrieval.
3. RESTful API (GameController): The GameController serves as the gateway for the frontend.
It uses Spring’s @RestController annotation to ensure that all data is automatically serialized
into JSON. The implementation features:
a. GET Endpoint: /api/leaderboard returns a list of GameStat objects, which the frontend
uses to build the ranking table.
b. POST Endpoint: /api/result accepts a JSON payload containing the player's name and
the match outcome. This endpoint acts as the bridge that connects the real-time gameplay
to the persistent database.
4.1.2 Frontend Implementation (Web Technologies & Game Engine)
The frontend was designed as a lightweight 'Game Engine' running entirely within the user's browser
using Vanilla JavaScript.
1. The Game State Logic: The entire board state is represented by a 1D array of nine strings:
gameState = ["", "", "", ..., ""]. This simple structure makes it easy to manipulate and check for
winners. Every time a user clicks a cell, the engine updates this array and then triggers a validation
check.
2. Win Detection Algorithm: Instead of complex nested loops, the engine uses a predefined
constant array of Winning Conditions. This array contains the index triplets for all possible wins
(3 rows, 3 columns, and 2 diagonals). After each move, the engine iterates through these
conditions to see if the symbols at those three indices match. This approach is computationally
efficient and highly readable.
3. Asynchronous Communication (Fetch API): To provide a seamless experience without page
reloads, the frontend uses the modern fetch() API. When a game ends, the result is sent to the
backend in the background. Once the backend confirms the save, the frontend then fetches the
updated leaderboard and refreshes the table dynamically.
4. AI Simulation: The Computer opponent is implemented using a randomized selection logic. It
filters the gameState array for empty indices and picks one at random. A setTimeout of 500ms
was added to simulate the computer 'thinking,' which significantly improves the user experience
by making the opponent feel more natural.
4.2 FEATURES AND FUNCTIONALITIES
1. User Authentication: A simple name-based login to track individual player scores.
2. Interactive Gameplay: Smooth animations and color-coded symbols for clarity.
3. Real-time Leaderboard: The leaderboard updates immediately after a match concludes.
4. Database Persistence: Results are written to a .db file, ensuring data isn't lost.
5. Reset Capability: Players can restart the game at any time without losing their overall statistics.
CHAPTER 5: TESTING
5.1 Testing Strategy
The comprehensive testing strategy for the "Tic-Tac-Toe Deluxe" project involved rigorous verification of
both the server-side persistence layer and the client-side game engine. We adopted a multi-tiered approach,
prioritizing White-Box testing for the backend logic (JDBC/SQL and Spring Controllers) and functional
Black-Box testing for the web-based UI. The core goal was to ensure data integrity and a seamless user
experience. The testing process was divided into Unit Testing for isolated components and Functional
Testing for end-to-end user flows.
5.2 Unit Testing
Unit testing focused on isolating critical business and data modules to verify their correctness. The primary
targets were the GameController and the GameRepository.
- GameController Endpoints: The REST endpoints (/api/result and /api/leaderboard) were tested
to ensure they correctly handled incoming JSON payloads and returned data in the expected
format (JSON serialization). We verified that invalid or incomplete payloads were rejected,
maintaining system robustness.
- Persistence Layer Logic (GameRepository): This layer was critical for data integrity. The
repository methods were tested to confirm that the upsert logic correctly differentiated between
new and existing players. Furthermore, we verified that atomic updates to the database
(incrementing wins, losses, or draws) executed successfully via JdbcTemplate and that
RowMappers correctly converted SQL result sets into Java GameStat objects.
5.3 Functional Testing
Functional testing covered the complete user flow from game start to leaderboard update, ensuring the web
application delivered a correct and interactive experience.
- Scenario 1: User Wins a Game.
○ Test: A user completes a winning sequence (e.g., three 'X's in a row).
○ Expected Result: The JavaScript frontend displays a "Winner" message. An
asynchronous POST request is successfully sent to the /api/result endpoint. The backend
updates the SQLite database, incrementing the player's win count by 1. Finally, the
leaderboard dynamically refreshes to show the updated ranking.
- Scenario 2: Board is Full with No Winner (Draw).
○ Test: The 3x3 grid is completely filled without any of the eight predefined winning
conditions being met.
○ Expected Result: A "Draw" message appears in the UI. A POST request is sent to the
backend, and the corresponding player's draw count in the database increases by 1.
- Scenario 3: Computer Opponent Makes a Move.
○ Test: The user makes a move, yielding control to the AI opponent.
○ Expected Result: There is a visible 500ms delay, simulating "thinking." The 'O' symbol
then appears in a randomly selected, unoccupied cell within the gameState array, and the
UI is correctly rendered
CHAPTER 6: RESULTS AND DISCUSSION
6.1 Results
The Tic-Tac-Toe Deluxe system successfully achieved a 100% success rate in game state
synchronization and database persistence operations. The SQLite database maintained full data
integrity throughout the testing phase, and the Java Spring Boot backend provided a response time of
less than 100ms for API requests, ensuring a smooth and lag-free gaming experience.
The primary advantage of this system is its modernized architecture, which replaces fragmented local
storage with a centralized relational database. The use of JDBC ensures that player statistics are
accurately recorded and easily retrievable. Furthermore, the automated leaderboard feature
significantly enhances user engagement by providing real-time competitive rankings, which is a major
improvement over static or non-persistent game implementations.
6.2 Limitations and Future Enhancements
Current limitations include the use of a randomized AI opponent, which can be easily defeated by
experienced players, and the lack of a real-time multiplayer mode over the internet.
Future enhancements will focus on:
● Advanced AI: Implementing the Minimax algorithm to create an "Unbeatable" difficulty level.
● Multiplayer Support: Utilizing WebSockets for real-time, cross-device matches between two
human players.
● Security: Implementing Role-Based Access Control (RBAC) and user authentication with
encrypted passwords for secure profile management.
CHAPTER 7: CONCLUSION
7.1 CONCLUSION
This project successfully integrates a Java backend with a modern web frontend. By using JDBC and
SQLite, it fulfills the requirements for database connectivity in a lightweight and portable manner. The
attractive UI demonstrates that Java applications can be both functional and visually appealing when
paired with modern web standards.
7.2 BIBLIOGRAPHY / REFERENCES
[1] Spring Boot Documentation ([Link])
[2] SQLite JDBC Driver (GitHub - xerial/sqlite-jdbc)
[3] MDN Web Docs for HTML/CSS/JS reference