This project implements Misere Tic-Tac-Toe that is a variant of Tic-Tac-Toe as an Android mobile app using Kotlin and Jetpack Compose.
In Misere Tic-Tac-Toe, the player who completes a line of three (row, column, or diagonal) loses.
The app supports both AI vs Human and Human vs Human (peer-to-peer) gameplay modes.
- Develop a Misere Tic-Tac-Toe mobile app for Android.
- Implement the Minimax algorithm with Alpha-Beta Pruning for AI gameplay.
- Provide three difficulty levels: Easy, Medium, and Hard.
- Support peer-to-peer (P2P) play via Bluetooth.
- Store completed games persistently with results and difficulty level.
- Build a modern UI using Jetpack Compose.
- The player (X) always starts, AI or Bot (O) responds.
- Difficulty modes:
- Easy: AI plays random moves.
- Medium: AI mixes random and optimal moves.
- Hard: AI plays optimally (Minimax + Alpha-Beta Pruning).
- Displays “AI Thinking…” when computing optimal moves.
- On-Device: Two players alternate turns on a single device.
- Two-Device (P2P): Players connect via Bluetooth and we pair them
- Moves, resets, and results sync across devices using JSON data.
- Includes a “Host/Join" option, whoever hosts starts the game.
- Bluetooth Multiplayer (Two Devices)
- Each finished game is saved with:
- Date and time
- Winner or Draw
- Difficulty level used
- Data persists even after app restart (Room DB or SharedPreferences).
- Game Screen: 3×3 grid for playing and resetting.
- Settings Screen: Adjust difficulty or enable vs Human mode.
- Past Games Screen: View history of completed matches.
- Android Studio (latest version)
- Kotlin 1.9+ with Jetpack Compose
- Android SDK 33+
- Optional: two Android devices for P2P testing
- Launch Android Studio → Open an Existing Project → Select the folder.
- Allow Gradle to sync automatically.
- Click Run ▶ in Android Studio.
- Choose a connected Android device or two(for P2P).
- The Game Screen will load as the start screen.
- Tap an empty cell to make your move (X).
- The AI (O) will respond immediately.
- The game ends when a player is forced to complete a line of three.
- Change difficulty anytime from Settings.
- Reset the board anytime using the Reset button.
- Completed matches appear in the Past Games list.
- Open Settings → Play vs Human (On-Device).
- Players take turns tapping empty cells.
- Either player can reset the board anytime.
- A message announces the result or draw.
- Select Settings → Play vs Human (Peer-to-Peer).
- Pair both phones in Android Settings → Bluetooth → Pair new device.
- On Phone A, open P2P Setup and tap "Host (Phone A)".
- On Phone B, open P2P Setup and tap "Join (Select Paired Host)", then choose Phone A from the list.
- Once both devices show "Connected", tap "Continue to Game" on both phones.Moves are mirrored in real time across both devices.
- When one device resets or finishes the game, both update automatically.
- Open the Past Games Screen.
- Review each match’s:
- Date and Time
- Winner or Draw
- Difficulty used
- Game history remains available after app restarts.
app/ ─ src/main/java/com/misere/tictactoe/ ─ data/ – Room entities and DAOs ─ p2p/ – Bluetooth peer-to-peer communication layer ─ repository/ – Repositories for game logic and settings ─ ui/screens/ – Compose screens for gameplay, settings, past games, and P2P setup ─ viewmodel/ – GameViewModel and P2PViewModel ─ AppNavigation.kt – NavHost for screen navigation ─ MainActivity.kt – Entry point for the app
- Language: Kotlin
- Framework: Jetpack Compose
- Algorithm: Minimax + Alpha-Beta Pruning
- Networking: Bluetooth APIs
- Storage: Room Database / SharedPreferences
- IDE: Android Studio
This project is intended for academic use as part of coursework for CSE 535 – Mobile Computing at Arizona State University.