na2hiro / Kifu-for-JS

JavaScriptで動く将棋の棋譜再生盤とそのブックマークレット `kifu-for-js`、JSON棋譜フォーマット(JKF)の定義とKIF, KI2, CSAからの変換ライブラリ `json-kifu-format`、将棋のモデル`shogi.js`を含むmonorepo
MIT License
112 stars 16 forks source link

Enforce checks for legal moves #94

Open na2hiro opened 9 years ago

na2hiro commented 9 years ago

Background

This library was originally created for Kifu for JS which is a viewer of Kifus. This is why there are not exhaustive checks which would be needed for usages like UIs which allows inputs of moves.

Current status

Currently it checks legality in the following points:

(2018-02-24) Following checked were added

The needs

It's not difficult to imagine some usages like to provide UI for playing Shogi. For such case we don't want allow users to input illegal moves.

Let's consider adding some more checks which would make sense:

There should be needs to handle illegal moves. Consider an option to accept such moves other than only throwing exceptions.

na2hiro commented 6 years ago

0ef265de04acb8f8a44343a7803d3bb18bb5b7d2 で二歩と行き所のない駒の判定を追加.打ち歩詰め,千日手,王手千日手もあると良い.