A Strategic Duel of Algorithms powered by Divide & Conquer, Dynamic Programming, Backtracking, and Alpha-Beta Pruning.
Course: Design & Analysis of Algorithms (DAA)
Team: Team-13
Live Web Deployment: ganesh2006646.github.io/FLIP
Status: Review 3 Complete (Web Port + JavaFX Application)
Flip Wars is a strategic tile-flipping game played on a grid (
Key features include:
- Dual Platform: Native JavaFX desktop application + modern responsive Web App.
- Black Hole Voids: Irregular graph topology — black hole tiles have no adjacency and warp the graph.
- Tabu Search Lock Mechanic: Flipped tiles are locked for countdown turns to prevent infinite flip loops.
-
Real-Time Brain Scanner Dashboard: Live algorithm diagnostics visualizing evaluated nodes (
$N$ ), pruned branches ($P$ ), Transposition Table hits ($DP$ ), table size ($TT$ ), move candidate rankings, and the recursive search tree.
- Play Online: Visit https://ganesh2006646.github.io/FLIP/.
-
Select AI Version:
- R1 (Greedy): Basic single-step AI with a 15% random blunder factor.
- R2 (Divide & Conquer): Strategic AI leveraging 5 Divide & Conquer algorithms.
- R3 (DP + Backtracking): Deep look-ahead AI using Alpha-Beta Minimax, Zobrist TT, and a 4x4 Exact DP Oracle.
-
Select Grid Size: Choose
$4 \times 4$ ,$5 \times 5$ , or$6 \times 6$ . - Gameplay: Click a tile to flip it and its orthogonal neighbors. Secure corners (+25) and edges (+15) while avoiding trap tiles (-5).
- Solve / Hint Mode: Click Solve for AI auto-play or Hint to get the optimal recommended move.
- Tile-Value Heuristic: Corners (+25), Edges (+15), Standard (+5), Traps (-5).
- Blunder Factor: 15% random blunder rate for balanced difficulty.
- Merge Sort: Moves ranked descending.
| # | Algorithm | Category | Complexity | Purpose |
|---|---|---|---|---|
| 1 | Merge Sort | Sorting D&C | Ranks all candidate moves for player hints | |
| 2 | Spatial D&C | Geometric D&C | Divides grid into quadrants for regional territory control | |
| 3 | DFS Clusters | Structural D&C | Measures connected territory strength using recursive DFS | |
| 4 | Tournament Selection | Search Space D&C | Bracket knockout tournament to pick CPU move | |
| 5 | Threat Detection | Scoring D&C | Evaluates exposed friendly vs. enemy tiles per quadrant |
| # | Algorithm | Type | Complexity | Contributor | Description |
|---|---|---|---|---|---|
| 1 | Pure Backtracking | In-place XOR |
|
Suhas | In-place doMove / undoMove avoiding board clones |
| 2 | Alpha-Beta Minimax | Game Tree Search | Maneesh | Branch & bound pruning with D&C move ordering | |
| 3 | Zobrist Transposition Table | Top-Down DP |
|
Ganesh | 64-bit Zobrist hashing for board + lock state memoization |
| 4 | Bitmask DP Oracle (4x4) | Bottom-Up BFS |
|
Balaji | Precomputed BFS over all 65,536 4x4 states for exact hints |
| Grid Size | MAX_DEPTH | Evaluated Nodes (Alpha-Beta) |
|---|---|---|
| 4x4 | 6 | ~4K nodes + O(1) Bitmask DP Oracle |
| 5x5 | 4 | ~19K nodes |
| 6x6 | 3 | ~2K nodes |
| Feature | R1: Greedy | R2: Divide & Conquer | R3: DP + Backtracking |
|---|---|---|---|
| Traversal | Single-step iteration | Quadrant / Bracket breakdown | Deep state-space recursion |
| Time Complexity |
|
||
| Space Complexity | Transposition Table + 256KB Oracle | ||
| Core Backbone | Greedy heuristic | D&C tournament + DFS | Alpha-Beta Minimax + Zobrist DP |
| Black Hole Handling | Ignored | Quadrant split skipping | Graph adjacency list exclusion |
| Hint Quality | Single-step local best | D&C tournament champion | Exact |
.
├── index.html # Main Web App entry point
├── style.css # Glassmorphic arcade design system & animations
├── game.js # Complete JavaScript game engine & AI algorithms
├── run.bat # Windows script to launch native JavaFX app
├── README.md # Project documentation
├── lib/
│ └── javafx/ # JavaFX SDK dependencies
└── src/main/java/com/flipwars/
├── FlipWarsApp.java # JavaFX UI, application loop & Brain Scanner
├── Engine.java # AI Engine dispatcher (R1 / R2 / R3)
├── R3Algorithms.java # Alpha-Beta Minimax, Zobrist TT & 4x4 Oracle
├── DACAlgorithms.java # 4 D&C algorithms (Spatial, Cluster, Tournament, Threat)
├── Graph.java # Adjacency list graph representation
└── Rules.java # Tabu search lock mechanic & strategic weights
Simply open index.html in any web browser, or host locally:
npx serve .Then visit http://localhost:3000.
Ensure JDK 17+ is installed, then run:
run.batDesigned and developed for Design & Analysis of Algorithms (DAA) — Team-13.