This repository contains the progression of the Color Fill game, a Java Swing-based interactive game where you compete against the CPU to fill a grid with colors.
The project is organized into the following folders representing different stages of development:
This folder contains the foundation of the Color Fill game.
- Core Logic: Implements the base gameplay using Breadth-First Search (BFS) for the flood-fill mechanism.
- GUI: Initial Swing interface with grid rendering and color selection.
- CPU: A basic greedy AI that picks colors based on immediate gain.
- Difficulty: Support for Easy, Medium, and Hard grid sizes.
This folder contains significant enhancements over the first version, including Merge Sort and live game features.
- Sorting Implementation: Uses Merge Sort (Divide & Conquer) to rank color choices for the CPU.
- Live Scoring: Real-time score tracking for both players during the game.
- Turn Timer: A 10-second countdown for the human player to add a speed challenge.
This folder implements advanced algorithmic intelligence for the CPU player.
- Backtracking Logic: Replaces the greedy strategy with a Minimax Algorithm that looks ahead 3 moves.
- Dynamic Programming (DP): Uses Memoization to store and reuse evaluations of game states, significantly optimizing the recursive search.
Each folder contains its own source code and build instructions. Generally, to run the game from within either folder:
- Compile the code:
javac -d bin src/swingprac/*.java - Run the application:
java -cp bin swingprac.HelloSwing