This project is a simplified version of the popular game Candy Crush, implemented in C++. The game involves matching candies of the same color to score points and collect stars. The game offers two modes: a timed mode and a move-based mode. The player can swap adjacent candies to create matches of three or more, and the game provides hints if the player is stuck.
-
Two Game Modes:
- Timer Mode: The player has a limited time to make as many matches as possible.
- Move Mode: The player has a limited number of moves to achieve the goal of collecting stars.
-
Dynamic Grid Initialization: The game grid is dynamically initialized with random candy colors, ensuring no initial matches.
-
Match Detection: The game automatically detects and removes matches of three or more candies of the same color.
-
Star Collection: The game includes stars that can be collected by matching candies in their vicinity.
-
Hints: If the player is stuck, the game provides hints on possible moves.
-
Interactive Menu: The game features an interactive menu for starting the game, viewing instructions, and exiting.
- Start the Game: Choose the "Start" option from the main menu.
- Select Mode: Choose between Timer Mode or Move Mode.
- Swap Candies: Enter the coordinates of the two candies you want to swap. The candies must be adjacent.
- Create Matches: Swap candies to create matches of three or more of the same color to score points and collect stars.
- Use Hints: If you're stuck, the game will provide hints after a certain period of inactivity.
- Win the Game: Collect all stars to win the game.
The project is organized into several files:
-
linkedlistmatrix.handlinkedlistmatrix.cpp: These files define a 2D linked list structure used to represent the game grid. TheMatrixclass represents a node in the grid, and theLinkedList2Dclass manages the grid. -
candyCrash.handcandyCrash.cpp: These files contain the main game logic. TheNodeclass represents a candy in the grid, and theGridclass manages the game state, including grid initialization, match detection, and user interaction. -
candyCrashMain.cpp: This file contains themainfunction, which handles the game loop and user input.
To compile and run the game, use the following commands:
g++ -o candyCrash candyCrashMain.cpp candyCrash.cpp linkedlistmatrix.cpp
./candyCrash- C++ Standard Library: The game uses standard C++ libraries for input/output, threading, and random number generation.
- Multi-threading: The game uses threads to manage the countdown timer and hint system.
- Enhanced Graphics: Implement a graphical user interface (GUI) for a more engaging user experience.
- More Levels: Add multiple levels with increasing difficulty.
- Power-ups: Introduce power-ups that can be used to clear large sections of the grid.
This project is open-source and available under the MIT License. Feel free to modify and distribute it as per the license terms.
This project was developed as a part of a programming exercise. Contributions and feedback are welcome!