Inspiration
I wanted to build something which is unique, here we have 2 player mode and AI mode which is unbeatable.
What it does
This is a web-based Tic-Tac-Toe game with two distinct modes. Players can either challenge a friend in a two-player mode or test their skills against an unbeatable AI opponent. The game accurately detects wins, losses, and draws.
How we built it
The game was built using a standard web development stack: HTML5 for the game board's structure, CSS3 for styling and visual design, and JavaScript to handle the game logic. The core of the AI mode is the Minimax algorithm, which was implemented recursively to evaluate all possible moves and select the one that guarantees a win or a draw. A 2D array represents the game board, and functions were created to manage game states, handle player moves, and execute the AI's turns.
Challenges we ran into
- Correctly implementing the recursive logic of the Minimax algorithm, especially handling the base cases and correctly evaluating the board state.
- Optimising the Minimax algorithm to ensure the AI's move calculation was instantaneous.
- Designing a clean and intuitive user interface that clearly distinguishes between the two game modes and handles turn management effectively.
Accomplishments that we're proud of
- Successfully creating a fully functional and engaging game from scratch.
- Building a truly unbeatable AI, providing a significant challenge to any player.
- Demonstrating a solid understanding of a complex game theory algorithm and its practical application in a real-world project.
What we learned
- Gained hands-on experience with HTML, CSS and JavaScipt
- Deepened our understanding of recursion and its use in complex algorithms like Minimax.
- Strengthened our proficiency in building interactive web applications with HTML, CSS, and JavaScript.
What's next for Tic-Tac-Toe
We plan to expand the game's features by adding different board sizes (e.g., 4x4), introducing different difficulty levels for the AI, and potentially implementing an online multiplayer mode using WebSockets.