A secured web app to play Tic-tac-toe against a dummy computer opponent.
- Play a game on a 3x3 board with an option to go first or after the computer opponent.
- Computer opponent's AI chooses random squares, except when going first in which case the center tile is always picked.
- User game data is persisted to an in-memory database. As long as the server is not restarted, a player can leave and return to finish an in-progress game.
- App is secured with a username & password login. Database is seeded with two usernames
rickandmorty. Both have the same passwordpickle. - UI renders server-side in the name of simplicity. Each game move results in a full page refresh.
- For more info about the project and lessons learned, see: Little Code Gems.
- Unit tests: src/test/java/tictactoe/*
| Technology | |
|---|---|
| Language | Java 25 |
| Framework | Spring Boot v4.0 |
| Data Layer | H2 Database, JPA & Hibernate v7.2 |
| UI Layer | HTML, CSS, Javascript, Bootstrap v5, Thymeleaf v3.1 |
| Testing | JUnit 5, Mockito, AssertJ |
| Build Tool | Gradle v9.2 |
- Install Java 25.
- Tip: use SDKMAN! to effortlessly install and switch between Java versions and distros.
- Clone repo:
git clone https://github.com/randomvlad/TicTacToe.git - Navigate
cd TicTacToeand run applicable Gradle Wrapper command:- macOS/Unix:
./gradlew bootRun - Windows:
gradlew.bat bootRun
- macOS/Unix:
- Once app is running, go to http://localhost:8080/tictactoe/.
- Log in with username
rickormortyand passwordpickleto play a game. - To end app, kill process in terminal with
CTRL + C.





