Skip to content

Commit ec2f421

Browse files
authoredNov 12, 2024
Create 005-memory-game.md
1 parent 445f613 commit ec2f421

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
 

‎projects/005-memory-game.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Memory Game
2+
3+
## Project Objective
4+
5+
The goal of this project is to create a classic Memory game where players flip cards to find matching pairs. This game will help you practice DOM manipulation by dynamically updating the game board and event handling to respond to player actions.
6+
7+
## Project Overview
8+
9+
In the Memory game, players see a grid of facedown cards. Each card has a matching pair hidden somewhere in the grid. Players can click on two cards to reveal them. If the cards match, they stay face up. If not, they turn back over. The game continues until all pairs are matched.
10+
11+
### Requirements
12+
13+
1. **Game Board Setup (DOM Manipulation)**
14+
- Create a grid layout of cards using HTML and CSS.
15+
- Randomly assign pairs of matching symbols or images to the cards.
16+
17+
2. **Card Flipping (Event Handling)**
18+
- Add an event listener to each card to handle the flip when it is clicked.
19+
- Use JavaScript to toggle the visibility of each card's content on click.
20+
21+
3. **Match Checking**
22+
- Track the two cards that are clicked in each turn.
23+
- If the two cards match, leave them face up.
24+
- If they don’t match, flip them back over after a short delay.
25+
26+
4. **Winning Condition**
27+
- Display a “You Win!” message when all pairs are matched.
28+
29+
### Suggested Structure
30+
31+
1. **HTML Structure**
32+
- A container for the game grid.
33+
- Cards as individual elements inside the container, each with a hidden symbol or image.
34+
35+
2. **CSS Styling**
36+
- Style the cards to have a front (facedown) and back (revealed) view.
37+
- Use CSS to position the cards in a grid layout.
38+
39+
3. **JavaScript Functionality**
40+
- Shuffle and distribute matching pairs of symbols/images to the cards.
41+
- Track the player’s selections and check for matches.
42+
- Display the "You Win!" message when all pairs are found.

0 commit comments

Comments
 (0)
Please sign in to comment.