This project is a code-themed "concentration" or memory-matching game built with Angular. It demonstrates core framework concepts including component architecture, state management via services, and routing. Players flip cards to find matching pairs, with their score and remaining attempts tracked by the UI.
- Component-Based: Fully built using Angular components for the home screen, difficulty selector, and game board.
- Centralized State Management: Core game logic, card state, and player stats are managed in a single GamelogicService.
- RxJS Subscriptions: The SandBoxComponent subscribes to Observables (cards$, currentPlayer$, lockBoard$) from the service to update the UI in real-time.
- Dynamic UI: Player score and attempts remaining are dynamically rendered.
- CSS 3D Animations: Cards feature a smooth 3D flip animation using CSS perspective, transform, and transition properties.
- Game Controls: Includes logic for handling card clicks and a "Reset Game" button.
Follow these instructions to get a copy of the project up and running on your local machine.
You must have Node.js and the Angular CLI installed on your machine.
Bash
npm install -g @angular/cli Installation & Running Clone the repository:
git clone https://github.com/your-username/your-repo-name.gitNavigate to the project directory:
cd your-repo-name
Install NPM packages:npm installRun the development server:
ng serve --openThis will open the application in your default browser at http://localhost:4200/.
src/app/
├── home/ # The landing page component
├── difficulty-selector/ # Difficulty selection screen
│ ├── difficulty-selector.component.ts
│ └── ...
├── sand-box/ # The main game board component
│ ├── sand-box.component.ts
│ └── ...
└── gamelogic.service.ts # Manages all game state and logic
This project was generated using Angular CLI version 19.0.5.
To start a local development server, run:
ng serveOnce the server is running, open your browser and navigate to http://localhost:4200/. The application will automatically reload whenever you modify any of the source files.
To build the project run:
ng buildAngular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
For more information on using the Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference page.