Welcome to Tic Tac Toe Unbeatable — a React Native game where you can play:
- 👤 vs 👤 (Player vs Player)
- 👤 vs 🤖 (Player vs CPU)
- 🤖 vs 👤 (CPU vs Player)
- 🤖 vs 🤖 (CPU vs CPU)
Built with a strong focus on gameplay experience and an unbeatable AI using the Minimax algorithm.
git clone https://github.com/reinaldonetof/dot-ttt
cd dot-tttnpm install
# or
yarnnpm run ios
# or
npx expo start- The board is represented by 9 positions, indexed from 1 to 9.
- The state of the game is split into two arrays: player1Selection and player2Selection, each containing the positions selected by that player.
- After each move, the game checks if there's a winner or if the match ended in a draw.
-
The CPU makes its moves based on the Minimax algorithm, which recursively evaluates all possible game states and assigns scores to each:
- Win → +10
- Loss → -10
- Draw → 0
-
The AI will always choose the move that maximizes its score while minimizing the player's chances.
Players can choose from a set of emojis to represent their symbols:
["❌", "⭕", "🚀", "🚗", "👍", "👎", "🐶", "🐱"]A modal interface allows players to select their icons dynamically before starting the game.
⚛️ React Native (Expo) – for cross-platform mobile development
💡 TypeScript – provides type safety and better developer experience
🐻 Zustand – used for lightweight and efficient global state management through clean custom hooks
🧩 Atomic Design – component architecture follows Atomic Design principles for better scalability and reusability
🤖 Minimax Algorithm – for an unbeatable AI player
🧪 Jest – for unit testing logic such as win conditions and AI decisions
-
Choose between three game modes:
- 👤 vs 👤 (Human vs Human)
- 👤 vs 🤖 (Human vs CPU)
- 🤖 vs 👤 (CPU vs Human)
- 🤖 vs 🤖 (CPU vs Human)
-
Unbeatable CPU using the Minimax algorithm
-
Select custom player symbols (❌, ⭕, 🚀, 🐶, etc.)
-
Modal interface for symbol customization
To run unit tests:
npm run test
# or
yarn test- Win condition detection
- Draw detection
- CPU decisions through the Minimax algorithm
- Random first moves (when enabled)
