An open API service indexing awesome lists of open source software.

https://github.com/4ssh1/mine-sweeper

Currently building a classic Minesweeper game built with React, TypeScript, and Redux for state management. Features clean, modular architecture, scalable component design, and unit testing with Jest.
https://github.com/4ssh1/mine-sweeper

jest react redux typescript

Last synced: 3 months ago
JSON representation

Currently building a classic Minesweeper game built with React, TypeScript, and Redux for state management. Features clean, modular architecture, scalable component design, and unit testing with Jest.

Awesome Lists containing this project

README

          

## πŸ’£ Minesweeper Game

A classic Minesweeper game built with **React**, **TypeScript**, and **Redux** for state management. Features clean, modular architecture, scalable component design, and unit testing with **Jest**.

---

## 🎯 Features

- βš›οΈ Built with React and TypeScript
- Responsive grid layout
- Probability-based mine placement
- πŸ” Undo/Redo logic (coming soon)
- πŸ§ͺ Unit tested with Jest
- πŸ—ƒοΈ Redux-powered state management
- 🎨 Dynamic tile color feedback
- πŸ“Š Uses `console.table` for dev grid debugging
- ⏱️ Timer and mine counter (optional feature toggle)

---

## Getting Started

### Prerequisites

- Node.js >= 16
- npm or yarn

### Installation

```bash
git clone https://github.com/your-username/minesweeper-react.git
cd minesweeper-reac
npm install
# or
yarn

```

```bash
npm run dev
# or
yarn dev

```

## Project Structure

```
src
β”œβ”€β”€ App.tsx
β”œβ”€β”€ assets
β”œβ”€β”€ helpers
β”‚ β”œβ”€β”€ BoardTypes.tsx
| β”œβ”€β”€CellManipulation.tsx
β”œβ”€β”€ index.css
β”œβ”€β”€ jest.setup.ts
β”œβ”€β”€ main.tsx
β”œβ”€β”€ mocks
β”‚ β”œβ”€β”€ fileMock.js
β”œβ”€β”€ test
β”‚ β”œβ”€β”€ Board.test.ts
β”‚ β”œβ”€β”€ CellManipulation.test.ts
β”œβ”€β”€ vite-env.d.ts
```

# Run all test

```bash
npm run test
# or
yarn test
```

## Game Logic

- The board is generated with a size and density parameter.
- Mines are placed randomly based on a probability check.

### On reveal:
If tile is a bomb β†’ Game Over
If not:
Count adjacent mines
If 0 β†’ Recursively reveal surrounding tiles

### Win condition:

All non-bomb tiles are revealed
Field generation uses basic probability math, not complex algorithms.

## πŸ”§ Contributing
Fork the repository

Create a feature branch:

```bash
git checkout -b feature-name
git commit -m "feat: added something"
git push origin feature-name
```

Open a Pull Request

We welcome contributions for:
- New features
- Bug fixes
- Tests
- UI improvements

## πŸ“„ License
This project is licensed under the MIT License