# Draughts-React **Repository Path**: leeyamaster/draughts-react ## Basic Information - **Project Name**: Draughts-React - **Description**: 国际跳棋React版本 - **Primary Language**: Unknown - **License**: MPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-11 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 国际跳棋 (Draughts) - React Monorepo 国际跳棋的 JavaScript 实现,采用 Monorepo 架构,逻辑与 UI 分离,便于其他项目复用。 ## 项目结构 ``` draughts/ ├── packages/ │ ├── core/ # @draughts/core - 纯逻辑库(零依赖) │ ├── react/ # @draughts/react - React 棋盘组件 │ └── web/ # 示例 Web 应用 ├── package.json # workspace 根配置 └── ARCHITECTURE.md # 架构设计文档 ``` ## 快速开始 ```bash # 安装依赖 npm install # 构建所有包 npm run build # 启动示例应用 npm run dev ``` 访问 http://localhost:5173 进行对局。 ## 其他项目如何使用 ### 仅需逻辑(Node.js、CLI、AI 引擎) ```bash npm install @draughts/core ``` ```js import { Draughts } from '@draughts/core' const game = new Draughts() game.move({ from: 35, to: 30 }) console.log(game.fen()) ``` ### React 项目需要完整棋盘 ```bash npm install @draughts/core @draughts/react ``` ```jsx import { DraughtsBoard, useDraughts } from '@draughts/react' import '@draughts/react/style.css' function Game() { const { fen, move, getLegalMoves, gameOver } = useDraughts() const handleDrop = (source, target) => { const m = move(source, target) return m ? undefined : 'snapback' } return ( ) } ``` ## 开发 ```bash # 构建 core npm run build:core # 构建 react npm run build:react # 构建 web npm run build:web ``` ## License MPL-2.0