Skip to content

giabaoye/memory-card

Repository files navigation

πŸƒ Memory Card

A two-player memory card matching game built with React 19, TypeScript, and Vite. Test your memory by flipping cards and finding matching pairs!

Features

  • Two-player mode β€” Compete with a friend, taking turns to find matching pairs
  • Score tracking β€” Keep track of each player's matched pairs
  • Smooth animations β€” Card flip animations powered by Motion
  • 24 unique emoji cards β€” 48 cards total (24 pairs) for a challenging game
  • Turn indicator β€” Visual indicator showing whose turn it is
  • Reset game β€” Start a new game anytime with the reset button

Getting Started

Prerequisites

  • Node.js v18 or higher
  • npm, yarn, or pnpm

Installation

Clone the repository and install dependencies:

git clone <repository-url>
cd memory-card
npm install

Running the Game

Start the development server:

npm run dev

Open your browser and navigate to http://localhost:5173 to play the game.

Building for Production

npm run build

The built files will be in the dist folder, ready for deployment.

How to Play

  1. Player 1 starts β€” Click any card to flip it
  2. Flip a second card β€” Try to find a matching emoji
  3. Match found? β€” The current player scores a point and gets another turn
  4. No match? β€” Cards flip back and it's the other player's turn
  5. Game ends β€” When all pairs are found, the player with the most matches wins!

Tech Stack

Technology Purpose
React 19 UI framework
TypeScript Type safety
Vite Build tool & dev server
Motion Animations
ESLint Code linting

Project Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Card.tsx           # Individual card with flip animation
β”‚   β”œβ”€β”€ CardContainer.tsx  # Game board grid with card logic
β”‚   └── PlayerInformation.tsx  # Score display and turn indicator
β”œβ”€β”€ hooks/
β”‚   └── useGamePlay.ts     # Game state management hook
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ data.ts            # Card data and shuffle logic
β”‚   └── type.ts            # TypeScript type definitions
β”œβ”€β”€ App.tsx                # Main application component
└── main.tsx               # Application entry point

About

πŸƒ Memory Card

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors