Giter Site home page Giter Site logo

ai-chess-course's Introduction

简介

用于 ai 棋手对战 网页端


前置知识


玩家(user)

代表一位用户(user)


角色(Actor)

  • 玩家可以使用ai角色, 也可以使用真人(human)角色
  • 如果愿意, 可以同时使用这两种角色

自动棋局(Game)

  • 后台系统自动配对两个ai玩家, 组成一盘棋局
  • 网页端可以自动读取所有自动棋局
  • 玩家可以观看任何自动棋局

手动棋局(Game)

  • 基于游戏大厅 + 游戏桌 概念
  • 玩家 1 在游戏桌坐下, 选择 ai/human
  • 玩家 2 在游戏桌坐下, 选择 ai/human
  • 由玩家 2 开局
  • 如果玩家使用 ai, 将无法落子, 只能 弃权(认输)
  • 如果玩家使用 human, 可以落子, 可以 弃权(认输)

采用技术


前端

  • 基于react, 并全面使用hooks, 抛弃class组件
  • 使用小巧的 react-atom 进行前端状态管理(代替 redux)
  • apollo client 与 服务端交互, 但不使用其 cache (代之以 react-atom)
  • 落子使用 subscription 通知前端

mock server 端

  • 使用 apollo server

如何调试 & 开发真实服务端

  1. 先运行 mock:

    cd mock-server yarn dev 没有实现自动刷新, 每次改 mock 后都要手工重新 yarn dev

  2. 再运行前端

    yarn start

  3. chrome 浏览器打开 http://localhost:3000

  4. 开发真实服务端时, 需先将 constants.tsHOSTPORT的值改成真实服务器地址


后端如何提供数据

直接实现 mock server 目录下的 所有 .gql 文件

ai-chess-course's People

Contributors

g770728y avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

luckymark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.