Git Product home page Git Product logo

gobang_renju_es6_project's Introduction

项目简介

a project for GoBang 今年一年一直是忙的连轴转,觉得自己进步不是很大。年底有人说你给我写个五指棋看看。

希望走过路过,闲暇之余不吝指教,拜谢 demo online:https://www.zhoulujun.cn/demo/gobang/index.html

工程说明

  • npm run start 启动工程,自动打开浏览器
  • 工程由yo Reat Webpack 搭建
  • eslint 为自定义的前对规范。
  • Test 未写

程序说明

fiveGame 主程

五指棋主程序 继承 EventListen——事件蛮多,直接监听了决

主要函数如下

构造函数参数

let game=new FiveChessGame('# box');
 /**
   * @param contentSelect {String} canvas插入box的 选择器
   * @param chessBoardWidth {number} 棋盘宽度
   * @param gridCount {number} 棋盘格数
   * @param gridColor {string} 棋盘格颜色
   * @param chessBordBackground {string} 棋盘背景颜色
   * @param chessRadius {number} 棋盘背景颜色
   * @param focusColor {string} 焦点颜色
   */

启动函数

game.start();
/***
   *启动函数
   * @param playerArr {Array} 棋手数组
   */

比如多人游戏,可能单机跟多人下,或者网络上下

悔棋

game.retract();
 /**
   *撤销棋局
   * @returns {boolean}
   */

撤销悔棋

game.recovery();
 /**
   *恢复撤销
   */

重置游戏

game.reset();

判断输赢

this.checkWin();
 /**
   *判断棋局输赢
   * @param player {Player} 棋手
   * @param x {number} x轴坐标
   * @param y {number} y轴坐标
   * @return {boolean}
   */

事件

chessExist

此位置已经存在棋子了

 /**
   * @param x {number} x轴坐标
   * @param y {number} y轴坐标
   */

wining

赢棋了

 /**
   * @param player {Player} 棋手
   */

waitPlayer

等待棋手落子

 /**
   * @param player {Player} 棋手
   */

算法说明

gobang_renju_es6_project's People

Contributors

zhoulujun avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.