npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dousha99/cchess

v1.0.3

Published

Move and validation library for Chinese chess

Downloads

7

Readme

cchess - 中国象棋棋盘状态表示与验证库

记号说明

以开局时黑方右手侧車为原点建立右手坐标系,即行为 x 轴,列为 y 轴。

无论标记哪一方的棋子或动作,均使用此坐标系。

棋盘记号说明

一枚棋子的表示方法为 ${棋子类型}${行号}${列号}. 行号和列号均从 0 开始。 如开局时红方右手侧的俥为 R98.

棋子类型如下表所示:

| 类型 | 红方记号 | 黑方记号 | | ---- | ----- | ---- | | 兵卒 | P | p | | 炮砲 | C | c | | 俥車 | R | r | | 傌馬 | K | k | | 相象 | B | b | | 仕士 | A | a | | 帥將 | G | g |

保存一个棋盘时,所有棋子按记法依次写入为一个字符串。 棋子写入的顺序不做保证。

步法记号说明

步法记号由 5 部分组成:${棋子类型}${唯一性标识?}${列号}${方向}${位移}.

唯一性标识

当一列上有多个同类型的棋子时,按顺序为这些棋子从 1 开始标号。唯一性标识即为编号数。 编号的顺序:对于黑方,按行号递减方向依次编号;对于红方,按行号递增方向依次编号。

如果该列上该棋子唯一,则省略不写。

方向

对于黑方,行号增加方向为 +, 行号降低方向为 -; 对于红方,行号增加方向为 -, 行号降低方向为 +.

行号不改变,方向为 =.

位移

对于在水平与竖直方向上行走的棋子: 当方向不为 = 时,代表前进或后退几行;当方向为 = 时,代表去往的列号。

对于在斜线方向上行走的棋子: 方向始终不为 =. 位移代表去往的列号。

示例

开局

r00k01b02a03g04a05b06k07r08c21c27p30p32p34p36p38P60P62P64P66P68C71C77R90K91B92A93G94A95B96K97R98

残局

g04a05R08a14P37C44b46c61K76r82A84G94

样例应将方法:

  • 象 7 退 5: b6-4
  • 士 5 退 4: a4-3
  • 将 5 平 4: g4=3