Skip to content

Commit c16061c

Browse files
committed
docs: 完善README文档,添加项目介绍和在线演示链接
1 parent 87fdd58 commit c16061c

File tree

1 file changed

+92
-51
lines changed

1 file changed

+92
-51
lines changed

README.md

Lines changed: 92 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,95 @@
1-
# React + TypeScript + Vite
2-
3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4-
5-
Currently, two official plugins are available:
6-
7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9-
10-
## Expanding the ESLint configuration
11-
12-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13-
14-
```js
15-
export default tseslint.config({
16-
extends: [
17-
// Remove ...tseslint.configs.recommended and replace with this
18-
...tseslint.configs.recommendedTypeChecked,
19-
// Alternatively, use this for stricter rules
20-
...tseslint.configs.strictTypeChecked,
21-
// Optionally, add this for stylistic rules
22-
...tseslint.configs.stylisticTypeChecked,
23-
],
24-
languageOptions: {
25-
// other options...
26-
parserOptions: {
27-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
28-
tsconfigRootDir: import.meta.dirname,
29-
},
30-
},
31-
})
1+
# LeetCode 200 - 岛屿数量可视化工具
2+
3+
🏝️ 直观可视化展示经典算法题"岛屿数量"的求解过程
4+
5+
## 🌐 在线演示
6+
7+
**[>> 立即访问在线演示 <<](https://fuck-algorithm.github.io/leetcode-200-number-of-islands/)**
8+
9+
## 📖 项目介绍
10+
11+
本项目是 [LeetCode 200. 岛屿数量](https://leetcode.com/problems/number-of-islands/) 问题的交互式可视化工具,通过动画方式展示深度优先搜索 (DFS) 和广度优先搜索 (BFS) 算法的执行过程,帮助理解算法的实现原理。
12+
13+
### 🔥 主要功能
14+
15+
- 🖼️ 直观展示DFS和BFS算法解决岛屿数量问题的过程
16+
- ⏯️ 动画播放控制:播放/暂停、步进、速度调节
17+
- 🎲 随机生成不同复杂度的岛屿图
18+
- ✏️ 支持自定义输入岛屿地图
19+
- 🔄 提供预设的示例地图
20+
- 🌍 中英文双语支持
21+
22+
## 🛠️ 技术栈
23+
24+
- **前端框架**:React + TypeScript
25+
- **构建工具**:Vite
26+
- **语言支持**:react-i18next
27+
- **样式**:CSS(自定义设计)
28+
29+
## 🔧 本地开发
30+
31+
### 环境要求
32+
33+
- Node.js 18+
34+
- npm 或 yarn
35+
36+
### 安装与运行
37+
38+
1. 克隆项目仓库
39+
```bash
40+
git clone https://github.com/fuck-algorithm/leetcode-200-number-of-islands.git
41+
cd leetcode-200-number-of-islands
42+
```
43+
44+
2. 安装依赖
45+
```bash
46+
npm install
47+
#
48+
yarn
49+
```
50+
51+
3. 启动开发服务器
52+
```bash
53+
npm run dev
54+
#
55+
yarn dev
56+
```
57+
58+
4. 在浏览器中访问 http://localhost:5173/leetcode-200-number-of-islands/
59+
60+
### 构建部署
61+
62+
```bash
63+
npm run build
64+
#
65+
yarn build
3266
```
3367

34-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35-
36-
```js
37-
// eslint.config.js
38-
import reactX from 'eslint-plugin-react-x'
39-
import reactDom from 'eslint-plugin-react-dom'
40-
41-
export default tseslint.config({
42-
plugins: {
43-
// Add the react-x and react-dom plugins
44-
'react-x': reactX,
45-
'react-dom': reactDom,
46-
},
47-
rules: {
48-
// other rules...
49-
// Enable its recommended typescript rules
50-
...reactX.configs['recommended-typescript'].rules,
51-
...reactDom.configs.recommended.rules,
52-
},
53-
})
68+
构建文件将输出到 `dist` 目录,可以将该目录部署到任何静态文件服务器。
69+
70+
## 🧩 项目结构
71+
5472
```
73+
src/
74+
├── components/ # UI组件
75+
├── utils/ # 工具函数和算法实现
76+
├── i18n/ # 国际化文件
77+
├── App.tsx # 主应用组件
78+
└── main.tsx # 应用入口
79+
```
80+
81+
## 📚 算法详解
82+
83+
岛屿数量问题是经典的图搜索算法应用,本项目实现了两种解法:
84+
85+
1. **深度优先搜索 (DFS)**:从一个陆地格子出发,使用递归或栈访问所有相邻的陆地格子,将访问过的陆地标记为已访问,以避免重复计数。
86+
87+
2. **广度优先搜索 (BFS)**:同样从一个陆地格子出发,但使用队列按层访问相邻的陆地格子,适合寻找最短路径等场景。
88+
89+
## 🤝 贡献指南
90+
91+
欢迎提交问题和改进建议!请通过GitHub Issues或Pull Requests参与项目。
92+
93+
## 📜 许可证
94+
95+
[MIT](LICENSE)

0 commit comments

Comments
 (0)