shogi.js 2.0.1 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +27 -0
- package/.nvmrc +1 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +5 -0
- package/.travis.yml +3 -0
- package/README.md +21 -23
- package/dist/shogi.js +3 -2
- package/dist/src/Color.d.ts +6 -1
- package/dist/src/Kind.d.ts +19 -0
- package/dist/src/Piece.d.ts +45 -5
- package/dist/src/Serialization.d.ts +1 -1
- package/dist/src/moveDefinitions.d.ts +3 -0
- package/dist/src/polyfills.d.ts +1 -1
- package/dist/src/presets.d.ts +74 -0
- package/dist/src/shogi.d.ts +170 -0
- package/package.json +25 -15
- package/.LISENCE.txt.un~ +0 -0
- package/.npmignore +0 -11
- package/.shogi.ts.un~ +0 -0
- package/.test.html.un~ +0 -0
- package/dist/src/Constants.d.ts +0 -14
- package/dist/src/Shogi.d.ts +0 -88
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"plugin:jest/recommended",
|
|
10
|
+
"prettier",
|
|
11
|
+
],
|
|
12
|
+
parser: "@typescript-eslint/parser",
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: 13,
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
},
|
|
17
|
+
plugins: ["@typescript-eslint", "jest"],
|
|
18
|
+
ignorePatterns: [
|
|
19
|
+
".eslintrc.js",
|
|
20
|
+
"jest.config.js",
|
|
21
|
+
"webpack.config.js",
|
|
22
|
+
"docs/",
|
|
23
|
+
"bundle/",
|
|
24
|
+
"dist/",
|
|
25
|
+
],
|
|
26
|
+
rules: {},
|
|
27
|
+
};
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/gallium
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
package/.travis.yml
ADDED
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Shogi.js (Ver. 2.0)
|
|
1
|
+
# Shogi.js (Ver. 2.0) 
|
|
2
2
|
将棋の盤駒をモデルとするシンプルなJavaScriptライブラリ.TypeScript.
|
|
3
3
|
|
|
4
4
|
## インストール
|
|
5
5
|
|
|
6
|
-
```
|
|
6
|
+
```shell
|
|
7
7
|
npm install shogi.js
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -26,71 +26,69 @@ npm install shogi.js
|
|
|
26
26
|
|
|
27
27
|
通常モードは棋譜再生および対局を,編集モードは盤面編集をモデル化するものである.
|
|
28
28
|
|
|
29
|
-
##
|
|
30
|
-
各クラスのメソッドの概要についてはコメントを確認されたい.
|
|
31
|
-
また,`test`ディレクトリ以下のテストで実際の挙動を確認されたい.
|
|
29
|
+
## Docs
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* enum Color
|
|
36
|
-
* Black=0, White=1
|
|
37
|
-
* class Piece
|
|
38
|
-
* 駒を表すクラス
|
|
31
|
+
[TypeDoc ドキュメンテーション](http://apps.81.la/Shogi.js/docs/modules.html) を参照のこと。
|
|
32
|
+
また,`test`ディレクトリ以下のテストで実際の挙動を確認されたい.
|
|
39
33
|
|
|
40
34
|
## TODO
|
|
41
|
-
|
|
35
|
+
https://github.com/na2hiro/Shogi.js/issues
|
|
42
36
|
|
|
43
37
|
## 開発
|
|
44
38
|
|
|
45
39
|
### 準備
|
|
46
40
|
|
|
47
|
-
```
|
|
48
|
-
$ npm install
|
|
49
|
-
|
|
41
|
+
```shell
|
|
42
|
+
$ nvm i && nvm use && npm install
|
|
50
43
|
```
|
|
51
44
|
|
|
52
45
|
上記コマンドを実行することで開発に必要なパッケージをインストールできます.
|
|
53
46
|
|
|
54
|
-
* TypeScript
|
|
55
|
-
* Webpack
|
|
56
|
-
* Browserify (JSバンドルツール)
|
|
47
|
+
* TypeScript
|
|
48
|
+
* Webpack (バンドルツール)
|
|
57
49
|
* Jest (テストフレームワーク,カバレッジ計測)
|
|
58
50
|
* TSLint (Linter)
|
|
59
51
|
|
|
60
52
|
### コマンド
|
|
61
53
|
|
|
62
54
|
|
|
63
|
-
```
|
|
55
|
+
```shell
|
|
64
56
|
$ npm run build
|
|
65
57
|
$ npm run build:watch
|
|
66
58
|
```
|
|
67
59
|
|
|
68
60
|
ビルドが走ります.`build:watch`の場合,変更されるたびにビルドが走ります.
|
|
69
61
|
|
|
70
|
-
```
|
|
62
|
+
```shell
|
|
71
63
|
$ npm run test:watch
|
|
72
64
|
```
|
|
73
65
|
|
|
74
66
|
コンソールでテスト結果が表示されます.コードの変更が保存されるたびに必要なテストが再実行されるため,実装が既存の有効なテストを壊してないか簡単に確認できます.
|
|
75
67
|
|
|
76
|
-
```
|
|
68
|
+
```shell
|
|
77
69
|
$ npm run test
|
|
78
70
|
```
|
|
79
71
|
|
|
80
72
|
全てのテストが走るとともにカバレッジレポートが表示されます.`coverage/lcov-report/index.html`では,行ごとのカバレッジを確認できます.追加されたコードのブランチカバレッジが100%になるようにしてください.push時にチェックされ満たしていなければ却下されるはずです.
|
|
81
73
|
|
|
82
|
-
```
|
|
74
|
+
```shell
|
|
83
75
|
$ npm run lint
|
|
84
76
|
```
|
|
85
77
|
|
|
86
78
|
コードの品質が検査されます.エラーがあればそれに従い直してください.push前にもチェックされます.
|
|
87
79
|
|
|
88
|
-
```
|
|
80
|
+
```shell
|
|
89
81
|
$ npm run lint:fix
|
|
90
82
|
```
|
|
91
83
|
|
|
92
84
|
自動的に修正可能な問題(インデント等)を直してくれます.
|
|
93
85
|
|
|
86
|
+
```shell
|
|
87
|
+
$ npm run docs
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`docs/` 以下にドキュメントを生成します.
|
|
91
|
+
|
|
94
92
|
## license
|
|
95
93
|
|
|
96
94
|
MIT License (see LICENSE.txt)
|
package/dist/shogi.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
module.exports=function(t){function
|
|
1
|
+
module.exports=function(t){var o={};function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=o,r.d=function(t,o,e){r.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,o){if(1&o&&(t=r(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var n in t)r.d(e,n,function(o){return t[o]}.bind(null,n));return e},r.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(o,"a",o),o},r.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},r.p="",r(r.s=2)}([function(t,o,r){"use strict";var e;o.__esModule=!0,function(t){t[t.Black=0]="Black",t[t.White=1]="White"}(e||(e={})),o.default=e},function(t,o,r){"use strict";o.__esModule=!0;var e=r(0),n=function(){function t(t){this.color="+"===t.slice(0,1)?e.default.Black:e.default.White,this.kind=t.slice(1)}return t.promote=function(t){return{FU:"TO",KY:"NY",KE:"NK",GI:"NG",KA:"UM",HI:"RY"}[t]||t},t.unpromote=function(t){return{TO:"FU",NY:"KY",NK:"KE",NG:"GI",KI:"KI",UM:"KA",RY:"HI",OU:"OU"}[t]||t},t.canPromote=function(o){return t.promote(o)!==o},t.isPromoted=function(t){return["TO","NY","NK","NG","UM","RY"].indexOf(t)>=0},t.oppositeColor=function(t){return t===e.default.Black?e.default.White:e.default.Black},t.fromSFENString=function(o){var r="+"===o[0];r&&(o=o.slice(1));var e=new t((o.match(/[A-Z]/)?"+":"-")+{P:"FU",L:"KY",N:"KE",S:"GI",G:"KI",B:"KA",R:"HI",K:"OU"}[o.toUpperCase()]);return r&&e.promote(),e},t.prototype.promote=function(){this.kind=t.promote(this.kind)},t.prototype.unpromote=function(){this.kind=t.unpromote(this.kind)},t.prototype.inverse=function(){this.color=this.color===e.default.Black?e.default.White:e.default.Black},t.prototype.toCSAString=function(){return(this.color===e.default.Black?"+":"-")+this.kind},t.prototype.toSFENString=function(){var o={FU:"P",KY:"L",KE:"N",GI:"S",KI:"G",KA:"B",HI:"R",OU:"K"}[t.unpromote(this.kind)];return(t.isPromoted(this.kind)?"+":"")+(this.color===e.default.Black?o:o.toLowerCase())},t}();o.default=n},function(t,o,r){"use strict";o.__esModule=!0,o.Piece=o.Color=o.Shogi=void 0;
|
|
2
|
+
/** @license
|
|
2
3
|
* Shogi.js
|
|
3
4
|
* Copyright (c) 2014 na2hiro (https://github.com/na2hiro)
|
|
4
5
|
* This software is released under the MIT License.
|
|
5
6
|
* http://opensource.org/licenses/mit-license.php
|
|
6
7
|
*/
|
|
7
|
-
var e=r(0);o.Color=e.default;var n=r(
|
|
8
|
+
var e=r(0);o.Color=e.default;var n=r(3),i=r(1);o.Piece=i.default,r(4);var u=r(5),a=function(){function t(t){this.initialize(t)}return t.getIllegalUnpromotedRow=function(t){switch(t){case"FU":case"KY":return 1;case"KE":return 2;default:return 0}},t.getRowToOppositeEnd=function(t,o){return o===e.default.Black?t:10-t},t.prototype.initialize=function(t){void 0===t&&(t={preset:"HIRATE"}),u.fromPreset(this,t),this.flagEditMode=!1},t.prototype.initializeFromSFENString=function(t){u.fromSfen(this,t)},t.prototype.toCSAString=function(){return u.toCSA(this)},t.prototype.toSFENString=function(t){return void 0===t&&(t=1),u.toSfen(this,t)},t.prototype.editMode=function(t){this.flagEditMode=t},t.prototype.move=function(o,r,e,n,i){void 0===i&&(i=!1);var u=this.get(o,r);if(null==u)throw new Error("no piece found at "+o+", "+r);if(this.checkTurn(u.color),!this.flagEditMode&&!this.getMovesFrom(o,r).some((function(t){return t.to.x===e&&t.to.y===n})))throw new Error("cannot move from "+o+", "+r+" to "+e+", "+n);null!=this.get(e,n)&&this.capture(e,n);var a=t.getIllegalUnpromotedRow(u.kind)>=t.getRowToOppositeEnd(n,u.color);(i||a)&&u.promote(),this.set(e,n,u),this.set(o,r,null),this.nextTurn()},t.prototype.unmove=function(t,o,r,e,n,u){void 0===n&&(n=!1);var a,f=this.get(r,e);if(null==f)throw new Error("no piece found at "+r+", "+e);this.checkTurn(i.default.oppositeColor(f.color)),u&&(a=this.popFromHand(i.default.unpromote(u),f.color)).inverse();var s=this.flagEditMode;this.editMode(!0),this.move(r,e,t,o),n&&f.unpromote(),u&&(i.default.isPromoted(u)&&a.promote(),this.set(r,e,a)),this.editMode(s),this.prevTurn()},t.prototype.drop=function(t,o,r,e){if(void 0===e&&(e=this.turn),this.checkTurn(e),null!=this.get(t,o))throw new Error("there is a piece at "+t+", "+o);if(!this.getDropsBy(e).some((function(e){return e.to.x===t&&e.to.y===o&&e.kind===r})))throw new Error("Cannot move");var n=this.popFromHand(r,e);this.set(t,o,n),this.nextTurn()},t.prototype.undrop=function(t,o){var r=this.get(t,o);if(null==r)throw new Error("there is no piece at "+t+", "+o);this.checkTurn(i.default.oppositeColor(r.color)),this.pushToHand(r),this.set(t,o,null),this.prevTurn()},t.prototype.getMovesFrom=function(t,o){var r=function(t,o,r){if(t<1||9<t||o<1||9<o)return!1;var e=this.get(t,o);return null==e||e.color!==r}.bind(this),i=function(t,o,r){var e=this.get(t,o);return null!=e&&e.color!==r}.bind(this),u=this.get(t,o);if(null==u)return[];var a=n.getMoveDefinitions(u.kind),f=[],s={x:t,y:o},l=u.color===e.default.Black?1:-1;if(a.just)for(var d=0,c=a.just;d<c.length;d++){var h=c[d];r((K={x:s.x+h[0]*l,y:s.y+h[1]*l}).x,K.y,u.color)&&f.push({from:s,to:K})}if(a.fly)for(var p=0,v=a.fly;p<v.length;p++){h=v[p];for(var K={x:s.x+h[0]*l,y:s.y+h[1]*l};r(K.x,K.y,u.color)&&(f.push({from:s,to:{x:K.x,y:K.y}}),!i(K.x,K.y,u.color));)K.x+=h[0]*l,K.y+=h[1]*l}return f},t.prototype.getDropsBy=function(o){for(var r=[],e=[],n=[],i=1;i<=9;i++){for(var u=!1,a=1;a<=9;a++){var f=this.get(i,a);null==f?e.push({x:i,y:a}):f.color===o&&"FU"===f.kind&&(u=!0)}n.push(u)}for(var s={},l=0,d=this.hands[o];l<d.length;l++){var c=d[l].kind;if(!s[c]){s[c]=!0;for(var h=t.getIllegalUnpromotedRow(c),p=0,v=e;p<v.length;p++){var K=v[p];"FU"===c&&n[K.x-1]||(h>=t.getRowToOppositeEnd(K.y,o)||r.push({to:K,color:o,kind:c}))}}}return r},t.prototype.getMovesTo=function(t,o,r,e){void 0===e&&(e=this.turn);for(var n={x:t,y:o},i=[],u=1;u<=9;u++)for(var a=1;a<=9;a++){var f=this.get(u,a);if(f&&f.kind===r&&f.color===e)this.getMovesFrom(u,a).some((function(r){return r.to.x===t&&r.to.y===o}))&&i.push({from:{x:u,y:a},to:n})}return i},t.prototype.get=function(t,o){return this.board[t-1][o-1]},t.prototype.getHandsSummary=function(t){for(var o={FU:0,KY:0,KE:0,GI:0,KI:0,KA:0,HI:0},r=0,e=this.hands[t];r<e.length;r++){o[e[r].kind]++}return o},t.prototype.captureByColor=function(t,o,r){if(!this.flagEditMode)throw new Error("cannot edit board without editMode");var e=this.get(t,o);this.set(t,o,null),e.unpromote(),e.color!==r&&e.inverse(),this.pushToHand(e)},t.prototype.flip=function(t,o){if(!this.flagEditMode)throw new Error("cannot edit board without editMode");var r=this.get(t,o);return!!r&&(i.default.isPromoted(r.kind)?(r.unpromote(),r.inverse()):i.default.canPromote(r.kind)?r.promote():r.inverse(),!0)},t.prototype.setTurn=function(t){if(!this.flagEditMode)throw new Error("cannot set turn without editMode");this.turn=t},t.prototype.set=function(t,o,r){this.board[t-1][o-1]=r},t.prototype.capture=function(t,o){var r=this.get(t,o);this.set(t,o,null),r.unpromote(),r.inverse(),this.pushToHand(r)},t.prototype.pushToHand=function(t){this.hands[t.color].push(t)},t.prototype.popFromHand=function(t,o){for(var r=this.hands[o],e=0;e<r.length;e++)if(r[e].kind===t){var n=r[e];return r.splice(e,1),n}throw new Error(o+" has no "+t)},t.prototype.nextTurn=function(){this.flagEditMode||(this.turn=this.turn===e.default.Black?e.default.White:e.default.Black)},t.prototype.prevTurn=function(){this.flagEditMode||this.nextTurn()},t.prototype.checkTurn=function(t){if(!this.flagEditMode&&t!==this.turn)throw new Error("cannot move opposite piece")},t}();o.Shogi=a},function(t,o,r){"use strict";o.__esModule=!0,o.getMoveDefinitions=void 0;var e=[0,-1],n=[0,1],i=[1,0],u=[-1,0],a=[-1,-1],f=[1,-1],s=[-1,1],l=[1,1],d={just:[a,e,f,u,i,n]},c={FU:{just:[e]},KY:{fly:[e]},KE:{just:[[-1,-2],[1,-2]]},GI:{just:[a,e,f,s,l]},KI:d,TO:d,NY:d,NK:d,NG:d,KA:{fly:[a,f,s,l]},HI:{fly:[e,u,i,n]},OU:{just:[a,e,f,u,i,s,n,l]},UM:{fly:[a,f,s,l],just:[e,u,i,n]},RY:{fly:[e,u,i,n],just:[a,f,s,l]}};o.getMoveDefinitions=function(t){return c[t]}},function(t,o,r){"use strict";o.__esModule=!0,Array.prototype.some||(Array.prototype.some=function(t){if(null==this)throw new TypeError;var o=Object(this),r=o.length>>>0;if("function"!=typeof t)throw new TypeError;for(var e=arguments[1],n=0;n<r;n++)if(n in o&&t.call(e,o[n],n,o))return!0;return!1})},function(t,o,r){"use strict";o.__esModule=!0,o.toSfen=o.fromSfen=o.toCSA=o.fromPreset=void 0;var e=r(0),n=r(6),i=r(1);o.fromPreset=function(t,o){var r,u=[],a=[[],[]];if("OTHER"!==o.preset){for(var f=n.getInitialFromPreset(o.preset),s=0;s<9;s++){u[s]=[];for(var l=0;l<9;l++){var d=f.board[l].slice(24-3*s,24-3*s+3);u[s][l]=" * "===d?null:new i.default(d)}}r=f.turn}else{for(s=0;s<9;s++){u[s]=[];for(l=0;l<9;l++){var c=o.data.board[s][l];u[s][l]=c.kind?new i.default((c.color===e.default.Black?"+":"-")+c.kind):null}}r=o.data.color;for(var h=0;h<2;h++)for(var p in o.data.hands[h])if(o.data.hands[h].hasOwnProperty(p))for(d=(0===h?"+":"-")+p,s=0;s<o.data.hands[h][p];s++)a[h].push(new i.default(d))}t.board=u,t.turn=r,t.hands=a},o.toCSA=function(t){for(var o=[],r=0;r<9;r++){for(var n="P"+(r+1),i=8;i>=0;i--){var u=t.board[i][r];n+=null==u?" * ":u.toCSAString()}o.push(n)}for(var a=0;a<2;a++){n="P"+"+-"[a];for(var f=0,s=t.hands[a];f<s.length;f++){n+="00"+s[f].kind}o.push(n)}return o.push(t.turn===e.default.Black?"+":"-"),o.join("\n")},o.fromSfen=function(t,o){for(var r=[],n=0;n<9;n++){r[n]=[];for(var u=0;u<9;u++)r[n][u]=null}var a=o.split(" "),f=a[0],s=8,l=0;for(n=0;n<f.length;n++){var d=f[n];"+"===d&&(d+=f[++n]),d.match(/^[1-9]$/)?s-=Number(d):"/"===d?(l++,s=8):(r[s][l]=i.default.fromSFENString(d),s--)}t.board=r,t.turn="b"===a[1]?e.default.Black:e.default.White;var c=[[],[]],h=a[2];if("-"!==h)for(;h.length>0;){var p=1,v=h.match(/^[0-9]+/);v&&(p=Number(v[0]),h=h.slice(v[0].length));for(n=0;n<p;n++){var K=i.default.fromSFENString(h[0]);c[K.color].push(K)}h=h.slice(1)}t.hands=c},o.toSfen=function(t,o){for(var r=[],n=[],i=0;i<9;i++){for(var u="",a=0,f=8;f>=0;f--){var s=t.board[f][i];null==s?a++:(a>0&&(u+=""+a,a=0),u+=s.toSFENString())}a>0&&(u+=""+a),n.push(u)}if(r.push(n.join("/")),r.push(t.turn===e.default.Black?"b":"w"),0===t.hands[0].length&&0===t.hands[1].length)r.push("-");else{for(var l="",d={},c=0;c<2;c++)for(var h=0,p=t.hands[c];h<p.length;h++){var v=p[h].toSFENString();d[v]=(d[v]||0)+1}for(var K=0,I=["R","B","G","S","N","L","P","r","b","g","s","n","l","p"];K<I.length;K++){var g=I[K];d[g]>0&&(l+=(d[g]>1?d[g]:"")+g)}r.push(l)}return r.push(""+o),r.join(" ")}},function(t,o,r){"use strict";o.__esModule=!0,o.getInitialFromPreset=void 0;var e=r(0),n=" * * * * * * * * * ",i=["-FU-FU-FU-FU-FU-FU-FU-FU-FU",n,n,n,"+FU+FU+FU+FU+FU+FU+FU+FU+FU"," * +KA * * * * * +HI * ","+KY+KE+GI+KI+OU+KI+GI+KE+KY"],u=[n].concat(i),a={HIRATE:{board:["-KY-KE-GI-KI-OU-KI-GI-KE-KY"," * -HI * * * * * -KA * "].concat(i),turn:e.default.Black},KY:{board:["-KY-KE-GI-KI-OU-KI-GI-KE * "," * -HI * * * * * -KA * "].concat(i),turn:e.default.White},KY_R:{board:[" * -KE-GI-KI-OU-KI-GI-KE-KY"," * -HI * * * * * -KA * "].concat(i),turn:e.default.White},KA:{board:["-KY-KE-GI-KI-OU-KI-GI-KE-KY"," * -HI * * * * * * * "].concat(i),turn:e.default.White},HI:{board:["-KY-KE-GI-KI-OU-KI-GI-KE-KY"," * * * * * * * -KA * "].concat(i),turn:e.default.White},HIKY:{board:["-KY-KE-GI-KI-OU-KI-GI-KE * "," * * * * * * * -KA * "].concat(i),turn:e.default.White},2:{board:["-KY-KE-GI-KI-OU-KI-GI-KE-KY"].concat(u),turn:e.default.White},3:{board:["-KY-KE-GI-KI-OU-KI-GI-KE * "].concat(u),turn:e.default.White},4:{board:[" * -KE-GI-KI-OU-KI-GI-KE * "].concat(u),turn:e.default.White},5:{board:[" * * -GI-KI-OU-KI-GI-KE * "].concat(u),turn:e.default.White},"5_L":{board:[" * -KE-GI-KI-OU-KI-GI * * "].concat(u),turn:e.default.White},6:{board:[" * * -GI-KI-OU-KI-GI * * "].concat(u),turn:e.default.White},"7_R":{board:[" * * * -KI-OU-KI-GI * * "].concat(u),turn:e.default.White},"7_L":{board:[" * * -GI-KI-OU-KI * * * "].concat(u),turn:e.default.White},8:{board:[" * * * -KI-OU-KI * * * "].concat(u),turn:e.default.White},10:{board:[" * * * * -OU * * * * "].concat(u),turn:e.default.White}};o.getInitialFromPreset=function(t){var o=a[t];if(!o)throw new Error("Unknown preset: "+t);return o};var f=Object.keys(a);o.default=f}]);
|
package/dist/src/Color.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare enum KindEnum {
|
|
2
|
+
FU = 0,
|
|
3
|
+
KY = 1,
|
|
4
|
+
KE = 2,
|
|
5
|
+
GI = 3,
|
|
6
|
+
KI = 4,
|
|
7
|
+
KA = 5,
|
|
8
|
+
HI = 6,
|
|
9
|
+
OU = 7,
|
|
10
|
+
TO = 8,
|
|
11
|
+
NY = 9,
|
|
12
|
+
NK = 10,
|
|
13
|
+
NG = 11,
|
|
14
|
+
UM = 12,
|
|
15
|
+
RY = 13
|
|
16
|
+
}
|
|
17
|
+
export declare type Kind = keyof typeof KindEnum;
|
|
18
|
+
export declare const values: Kind[];
|
|
19
|
+
export {};
|
package/dist/src/Piece.d.ts
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
1
|
import Color from "./Color";
|
|
2
|
+
import { Kind } from "./Kind";
|
|
3
|
+
/**
|
|
4
|
+
* 駒を表すクラス
|
|
5
|
+
*/
|
|
2
6
|
export default class Piece {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
static
|
|
7
|
+
/**
|
|
8
|
+
* 成った時の種類を返す.なければそのまま.
|
|
9
|
+
*/
|
|
10
|
+
static promote(kind: Kind): Kind;
|
|
11
|
+
/**
|
|
12
|
+
* 表に返した時の種類を返す.表の場合はそのまま.
|
|
13
|
+
*/
|
|
14
|
+
static unpromote(kind: Kind): Kind;
|
|
15
|
+
/**
|
|
16
|
+
* 成れる駒かどうかを返す
|
|
17
|
+
*/
|
|
18
|
+
static canPromote(kind: Kind): boolean;
|
|
19
|
+
static isPromoted(kind: Kind): boolean;
|
|
7
20
|
static oppositeColor(color: Color): Color;
|
|
21
|
+
/**
|
|
22
|
+
* SFENによる文字列表現から駒オブジェクトを作成
|
|
23
|
+
*/
|
|
8
24
|
static fromSFENString(sfen: string): Piece;
|
|
25
|
+
/**
|
|
26
|
+
* 先後
|
|
27
|
+
*/
|
|
9
28
|
color: Color;
|
|
10
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 駒の種類
|
|
31
|
+
*/
|
|
32
|
+
kind: Kind;
|
|
33
|
+
/**
|
|
34
|
+
* "+FU"などのCSAによる駒表現から駒オブジェクトを作成
|
|
35
|
+
*/
|
|
11
36
|
constructor(csa: string);
|
|
37
|
+
/**
|
|
38
|
+
* 成る
|
|
39
|
+
*/
|
|
12
40
|
promote(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 不成にする
|
|
43
|
+
*/
|
|
13
44
|
unpromote(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 駒の向きを反転する
|
|
47
|
+
*/
|
|
14
48
|
inverse(): void;
|
|
49
|
+
/**
|
|
50
|
+
* CSAによる駒表現の文字列を返す
|
|
51
|
+
*/
|
|
15
52
|
toCSAString(): string;
|
|
53
|
+
/**
|
|
54
|
+
* SFENによる駒表現の文字列を返す
|
|
55
|
+
*/
|
|
16
56
|
toSFENString(): string;
|
|
17
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISettingType, Shogi } from "./
|
|
1
|
+
import { ISettingType, Shogi } from "./shogi";
|
|
2
2
|
export declare function fromPreset(shogi: Shogi, setting: ISettingType): void;
|
|
3
3
|
export declare function toCSA(shogi: Shogi): string;
|
|
4
4
|
export declare function fromSfen(shogi: Shogi, sfen: string): void;
|
package/dist/src/polyfills.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Color from "./Color";
|
|
2
|
+
/**
|
|
3
|
+
* 既定の初期局面
|
|
4
|
+
*/
|
|
5
|
+
declare const presetDefinitions: {
|
|
6
|
+
HIRATE: {
|
|
7
|
+
board: string[];
|
|
8
|
+
turn: Color;
|
|
9
|
+
};
|
|
10
|
+
KY: {
|
|
11
|
+
board: string[];
|
|
12
|
+
turn: Color;
|
|
13
|
+
};
|
|
14
|
+
KY_R: {
|
|
15
|
+
board: string[];
|
|
16
|
+
turn: Color;
|
|
17
|
+
};
|
|
18
|
+
KA: {
|
|
19
|
+
board: string[];
|
|
20
|
+
turn: Color;
|
|
21
|
+
};
|
|
22
|
+
HI: {
|
|
23
|
+
board: string[];
|
|
24
|
+
turn: Color;
|
|
25
|
+
};
|
|
26
|
+
HIKY: {
|
|
27
|
+
board: string[];
|
|
28
|
+
turn: Color;
|
|
29
|
+
};
|
|
30
|
+
"2": {
|
|
31
|
+
board: string[];
|
|
32
|
+
turn: Color;
|
|
33
|
+
};
|
|
34
|
+
"3": {
|
|
35
|
+
board: string[];
|
|
36
|
+
turn: Color;
|
|
37
|
+
};
|
|
38
|
+
"4": {
|
|
39
|
+
board: string[];
|
|
40
|
+
turn: Color;
|
|
41
|
+
};
|
|
42
|
+
"5": {
|
|
43
|
+
board: string[];
|
|
44
|
+
turn: Color;
|
|
45
|
+
};
|
|
46
|
+
"5_L": {
|
|
47
|
+
board: string[];
|
|
48
|
+
turn: Color;
|
|
49
|
+
};
|
|
50
|
+
"6": {
|
|
51
|
+
board: string[];
|
|
52
|
+
turn: Color;
|
|
53
|
+
};
|
|
54
|
+
"7_R": {
|
|
55
|
+
board: string[];
|
|
56
|
+
turn: Color;
|
|
57
|
+
};
|
|
58
|
+
"7_L": {
|
|
59
|
+
board: string[];
|
|
60
|
+
turn: Color;
|
|
61
|
+
};
|
|
62
|
+
"8": {
|
|
63
|
+
board: string[];
|
|
64
|
+
turn: Color;
|
|
65
|
+
};
|
|
66
|
+
"10": {
|
|
67
|
+
board: string[];
|
|
68
|
+
turn: Color;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export declare type IPreset = keyof typeof presetDefinitions;
|
|
72
|
+
export declare const getInitialFromPreset: (preset: string) => any;
|
|
73
|
+
declare const presets: string[];
|
|
74
|
+
export default presets;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Shogi.js
|
|
3
|
+
* Copyright (c) 2014 na2hiro (https://github.com/na2hiro)
|
|
4
|
+
* This software is released under the MIT License.
|
|
5
|
+
* http://opensource.org/licenses/mit-license.php
|
|
6
|
+
*/
|
|
7
|
+
import Color from "./Color";
|
|
8
|
+
import IMoveDefinition from "./IMoveDefinition";
|
|
9
|
+
import { Kind } from "./Kind";
|
|
10
|
+
import Piece from "./Piece";
|
|
11
|
+
import "./polyfills";
|
|
12
|
+
/**
|
|
13
|
+
* 将棋盤を管理するクラス
|
|
14
|
+
*/
|
|
15
|
+
export declare class Shogi {
|
|
16
|
+
private static getIllegalUnpromotedRow;
|
|
17
|
+
/**
|
|
18
|
+
* 手番の相手側から数えた段数
|
|
19
|
+
*/
|
|
20
|
+
private static getRowToOppositeEnd;
|
|
21
|
+
/**
|
|
22
|
+
* 盤面
|
|
23
|
+
*/
|
|
24
|
+
board: Piece[][];
|
|
25
|
+
/**
|
|
26
|
+
* 持ち駒
|
|
27
|
+
*/
|
|
28
|
+
hands: Piece[][];
|
|
29
|
+
/**
|
|
30
|
+
* 次の手番
|
|
31
|
+
*/
|
|
32
|
+
turn: Color;
|
|
33
|
+
/**
|
|
34
|
+
* 編集モードかどうか
|
|
35
|
+
*/
|
|
36
|
+
flagEditMode: boolean;
|
|
37
|
+
constructor(setting?: ISettingType);
|
|
38
|
+
/**
|
|
39
|
+
* 盤面を初期化する
|
|
40
|
+
* @param {ISettingType} setting 初期局面(なければ平手)
|
|
41
|
+
*/
|
|
42
|
+
initialize(setting?: ISettingType): void;
|
|
43
|
+
/**
|
|
44
|
+
* SFENによる盤面表現の文字列で盤面を初期化する
|
|
45
|
+
* @param {string} sfen
|
|
46
|
+
*/
|
|
47
|
+
initializeFromSFENString(sfen: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* CSAによる盤面表現の文字列を返す
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
toCSAString(): string;
|
|
53
|
+
/**
|
|
54
|
+
* SFENによる盤面表現の文字列を返す
|
|
55
|
+
* @param {number} moveCount
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
toSFENString(moveCount?: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* 編集モード切り替え
|
|
61
|
+
* * 通常モード:移動時に手番と移動可能かどうかチェックし,移動可能範囲は手番側のみ返す.
|
|
62
|
+
* * 編集モード:移動時に手番や移動可能かはチェックせず,移動可能範囲は両者とも返す.
|
|
63
|
+
*/
|
|
64
|
+
editMode(flag: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* (fromx, fromy)から(tox, toy)へ移動し,promoteなら成り,駒を取っていれば持ち駒に加える..
|
|
67
|
+
*/
|
|
68
|
+
move(fromx: number, fromy: number, tox: number, toy: number, promote?: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* moveの逆を行う.つまり(tox, toy)から(fromx, fromy)へ移動し,駒を取っていたら戻し,promoteなら成りを戻す.
|
|
71
|
+
*/
|
|
72
|
+
unmove(fromx: number, fromy: number, tox: number, toy: number, promote?: boolean, capture?: Kind): void;
|
|
73
|
+
/**
|
|
74
|
+
* (tox, toy)へcolorの持ち駒のkindを打つ.
|
|
75
|
+
*/
|
|
76
|
+
drop(tox: number, toy: number, kind: Kind, color?: Color): void;
|
|
77
|
+
/**
|
|
78
|
+
* dropの逆を行う,つまり(tox, toy)の駒を駒台に戻す.
|
|
79
|
+
*/
|
|
80
|
+
undrop(tox: number, toy: number): void;
|
|
81
|
+
/**
|
|
82
|
+
* (x, y)の駒の移動可能な動きをすべて得る
|
|
83
|
+
* 盤外,自分の駒取りは除外.二歩,王手放置などはチェックせず.
|
|
84
|
+
*/
|
|
85
|
+
getMovesFrom(x: number, y: number): IMove[];
|
|
86
|
+
/**
|
|
87
|
+
* colorが打てる動きを全て得る
|
|
88
|
+
*/
|
|
89
|
+
getDropsBy(color: Color): IMove[];
|
|
90
|
+
/**
|
|
91
|
+
* (x, y)に行けるcolor側のkindの駒の動きを得る
|
|
92
|
+
*/
|
|
93
|
+
getMovesTo(x: number, y: number, kind: Kind, color?: Color): IMove[];
|
|
94
|
+
/**
|
|
95
|
+
* (x, y)の駒を得る
|
|
96
|
+
*/
|
|
97
|
+
get(x: number, y: number): Piece;
|
|
98
|
+
/**
|
|
99
|
+
* keyを種類,valueを枚数とするオブジェクトとして持ち駒の枚数一覧を返す.
|
|
100
|
+
*/
|
|
101
|
+
getHandsSummary(color: Color): HandSummary;
|
|
102
|
+
/**
|
|
103
|
+
* (x, y)の駒を取ってcolorの持ち駒に加える
|
|
104
|
+
*/
|
|
105
|
+
captureByColor(x: number, y: number, color: Color): void;
|
|
106
|
+
/**
|
|
107
|
+
* (x, y)の駒をフリップする(先手→先手成→後手→後手成→)
|
|
108
|
+
* 成功したらtrueを返す
|
|
109
|
+
*/
|
|
110
|
+
flip(x: number, y: number): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* 手番を設定する
|
|
113
|
+
*/
|
|
114
|
+
setTurn(color: Color): void;
|
|
115
|
+
/**
|
|
116
|
+
* (x, y)に駒を置く
|
|
117
|
+
*/
|
|
118
|
+
private set;
|
|
119
|
+
/**
|
|
120
|
+
* (x, y)の駒を取って反対側の持ち駒に加える
|
|
121
|
+
*/
|
|
122
|
+
private capture;
|
|
123
|
+
/**
|
|
124
|
+
* 駒pieceを持ち駒に加える
|
|
125
|
+
*/
|
|
126
|
+
private pushToHand;
|
|
127
|
+
/**
|
|
128
|
+
* color側のkindの駒を取って返す
|
|
129
|
+
*/
|
|
130
|
+
private popFromHand;
|
|
131
|
+
/**
|
|
132
|
+
* 次の手番に行く
|
|
133
|
+
*/
|
|
134
|
+
private nextTurn;
|
|
135
|
+
/**
|
|
136
|
+
* 前の手番に行く
|
|
137
|
+
*/
|
|
138
|
+
private prevTurn;
|
|
139
|
+
/**
|
|
140
|
+
* colorの手番で問題ないか確認する.編集モードならok.
|
|
141
|
+
*/
|
|
142
|
+
private checkTurn;
|
|
143
|
+
}
|
|
144
|
+
declare type HandSummary = {
|
|
145
|
+
[K in Extract<Kind, "FU" | "KY" | "KE" | "GI" | "KI" | "KA" | "HI">]: number;
|
|
146
|
+
};
|
|
147
|
+
export interface ISettingType {
|
|
148
|
+
preset: string;
|
|
149
|
+
data?: {
|
|
150
|
+
color: Color;
|
|
151
|
+
board: Array<Array<{
|
|
152
|
+
color?: Color;
|
|
153
|
+
kind?: Kind;
|
|
154
|
+
}>>;
|
|
155
|
+
hands: HandSummary[];
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export interface IMove {
|
|
159
|
+
from?: {
|
|
160
|
+
x: number;
|
|
161
|
+
y: number;
|
|
162
|
+
};
|
|
163
|
+
to: {
|
|
164
|
+
x: number;
|
|
165
|
+
y: number;
|
|
166
|
+
};
|
|
167
|
+
kind?: Kind;
|
|
168
|
+
color?: Color;
|
|
169
|
+
}
|
|
170
|
+
export { Color, Piece, IMoveDefinition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shogi.js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "simple shogi library for JavaScript",
|
|
5
5
|
"main": "dist/shogi.js",
|
|
6
6
|
"types": "dist/src/shogi.d.ts",
|
|
@@ -8,13 +8,17 @@
|
|
|
8
8
|
"test": "test"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "
|
|
12
|
-
"build:analyze": "
|
|
13
|
-
"build:watch": "
|
|
14
|
-
"lint": "./
|
|
15
|
-
"lint:fix": "./
|
|
11
|
+
"build": "webpack --mode=production -p",
|
|
12
|
+
"build:analyze": "webpack --mode=production -p --env.analyze",
|
|
13
|
+
"build:watch": "webpack --mode=development --watch",
|
|
14
|
+
"lint": "eslint ./ && prettier --check .",
|
|
15
|
+
"lint:fix": "eslint ./ --fix && prettier --write .",
|
|
16
16
|
"test": "jest",
|
|
17
|
-
"test:watch": "jest --watch"
|
|
17
|
+
"test:watch": "jest --watch",
|
|
18
|
+
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"docs": "typedoc --exclude '**/__tests__/**/*' ./src/shogi.ts",
|
|
21
|
+
"deploy:ghpages": "rm -rf ./public && mkdir -p ./public && npm run docs && mv ./docs ./public/"
|
|
18
22
|
},
|
|
19
23
|
"repository": {
|
|
20
24
|
"type": "git",
|
|
@@ -32,16 +36,22 @@
|
|
|
32
36
|
"homepage": "https://github.com/na2hiro/Shogi.js#readme",
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"@types/jest": "^22.2.0",
|
|
35
|
-
"
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.9.0",
|
|
36
41
|
"clean-webpack-plugin": "^0.1.19",
|
|
37
|
-
"
|
|
42
|
+
"eslint": "^8.6.0",
|
|
43
|
+
"eslint-config-prettier": "^8.3.0",
|
|
44
|
+
"eslint-plugin-jest": "^25.3.4",
|
|
45
|
+
"jest": "^26.1.0",
|
|
38
46
|
"pre-push": "^0.1.1",
|
|
39
|
-
"
|
|
40
|
-
"ts-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"webpack
|
|
47
|
+
"prettier": "^2.5.1",
|
|
48
|
+
"ts-jest": "^26.4.3",
|
|
49
|
+
"ts-loader": "^4.3.1",
|
|
50
|
+
"typedoc": "^0.20.35",
|
|
51
|
+
"typescript": "^4.0.5",
|
|
52
|
+
"webpack": "^4.43.0",
|
|
53
|
+
"webpack-bundle-analyzer": "^3.8.0",
|
|
54
|
+
"webpack-cli": "^3.3.11",
|
|
45
55
|
"webpack-merge": "^4.1.2"
|
|
46
56
|
},
|
|
47
57
|
"pre-push": [
|
package/.LISENCE.txt.un~
DELETED
|
Binary file
|
package/.npmignore
DELETED
package/.shogi.ts.un~
DELETED
|
Binary file
|
package/.test.html.un~
DELETED
|
Binary file
|
package/dist/src/Constants.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Color from "./Color";
|
|
2
|
-
import IMoveDefinition from "./IMoveDefinition";
|
|
3
|
-
/**
|
|
4
|
-
* 既定の初期局面
|
|
5
|
-
*/
|
|
6
|
-
export declare const PRESET: Readonly<{
|
|
7
|
-
[index: string]: Readonly<{
|
|
8
|
-
readonly board: string[];
|
|
9
|
-
readonly turn: Color;
|
|
10
|
-
}>;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const MOVE_DEF: Readonly<{
|
|
13
|
-
[index: string]: Readonly<IMoveDefinition>;
|
|
14
|
-
}>;
|
package/dist/src/Shogi.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Shogi.js
|
|
3
|
-
* Copyright (c) 2014 na2hiro (https://github.com/na2hiro)
|
|
4
|
-
* This software is released under the MIT License.
|
|
5
|
-
* http://opensource.org/licenses/mit-license.php
|
|
6
|
-
*/
|
|
7
|
-
import Color from "./Color";
|
|
8
|
-
import IMoveDefinition from "./IMoveDefinition";
|
|
9
|
-
import Piece from "./Piece";
|
|
10
|
-
import "./polyfills";
|
|
11
|
-
export declare class Shogi {
|
|
12
|
-
private static getIllegalUnpromotedRow(kind);
|
|
13
|
-
private static getRowToOppositeEnd(y, color);
|
|
14
|
-
board: Piece[][];
|
|
15
|
-
hands: Piece[][];
|
|
16
|
-
turn: Color;
|
|
17
|
-
flagEditMode: boolean;
|
|
18
|
-
constructor(setting?: ISettingType);
|
|
19
|
-
/**
|
|
20
|
-
* 盤面を初期化する
|
|
21
|
-
* @param {ISettingType} setting 初期局面(なければ平手)
|
|
22
|
-
*/
|
|
23
|
-
initialize(setting?: ISettingType): void;
|
|
24
|
-
/**
|
|
25
|
-
* SFENによる盤面表現の文字列で盤面を初期化する
|
|
26
|
-
* @param {string} sfen
|
|
27
|
-
*/
|
|
28
|
-
initializeFromSFENString(sfen: string): void;
|
|
29
|
-
/**
|
|
30
|
-
* CSAによる盤面表現の文字列を返す
|
|
31
|
-
* @returns {string}
|
|
32
|
-
*/
|
|
33
|
-
toCSAString(): string;
|
|
34
|
-
/**
|
|
35
|
-
* SFENによる盤面表現の文字列を返す
|
|
36
|
-
* @param {number} moveCount
|
|
37
|
-
* @returns {string}
|
|
38
|
-
*/
|
|
39
|
-
toSFENString(moveCount?: number): string;
|
|
40
|
-
editMode(flag: boolean): void;
|
|
41
|
-
move(fromx: number, fromy: number, tox: number, toy: number, promote?: boolean): void;
|
|
42
|
-
unmove(fromx: number, fromy: number, tox: number, toy: number, promote?: boolean, capture?: string): void;
|
|
43
|
-
drop(tox: number, toy: number, kind: string, color?: Color): void;
|
|
44
|
-
undrop(tox: number, toy: number): void;
|
|
45
|
-
getMovesFrom(x: number, y: number): IMove[];
|
|
46
|
-
getDropsBy(color: Color): IMove[];
|
|
47
|
-
getMovesTo(x: number, y: number, kind: string, color?: Color): IMove[];
|
|
48
|
-
get(x: number, y: number): Piece;
|
|
49
|
-
getHandsSummary(color: Color): {
|
|
50
|
-
[index: string]: number;
|
|
51
|
-
};
|
|
52
|
-
captureByColor(x: number, y: number, color: Color): void;
|
|
53
|
-
flip(x: number, y: number): boolean;
|
|
54
|
-
setTurn(color: Color): void;
|
|
55
|
-
private set(x, y, piece);
|
|
56
|
-
private capture(x, y);
|
|
57
|
-
private pushToHand(piece);
|
|
58
|
-
private popFromHand(kind, color);
|
|
59
|
-
private nextTurn();
|
|
60
|
-
private prevTurn();
|
|
61
|
-
private checkTurn(color);
|
|
62
|
-
}
|
|
63
|
-
export interface ISettingType {
|
|
64
|
-
preset: string;
|
|
65
|
-
data?: {
|
|
66
|
-
color: Color;
|
|
67
|
-
board: Array<Array<{
|
|
68
|
-
color?: Color;
|
|
69
|
-
kind?: string;
|
|
70
|
-
}>>;
|
|
71
|
-
hands: Array<{
|
|
72
|
-
[index: string]: number;
|
|
73
|
-
}>;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export interface IMove {
|
|
77
|
-
from?: {
|
|
78
|
-
x: number;
|
|
79
|
-
y: number;
|
|
80
|
-
};
|
|
81
|
-
to: {
|
|
82
|
-
x: number;
|
|
83
|
-
y: number;
|
|
84
|
-
};
|
|
85
|
-
kind?: string;
|
|
86
|
-
color?: Color;
|
|
87
|
-
}
|
|
88
|
-
export { Color, Piece, IMoveDefinition };
|