ある位置における何らかの状態を「true」か「false」で表す2値変数です。
「verify」「if」「while」などにおける条件式で使用されます。
位置を指定しない場合、フラグは現在地の状態がtrueかfalseかを返します。
フラグは指定された位置<position>の状態がtrueかfalseかを返します。
フラグは指定された方向<direction>の状態がtrueかfalseかを返します。
※「not-」のついたフラグは、「(not フラグ)」という意味であり、フラグが反転します。
- 固有フラグ(設定できないフラグ):<position-condition>
フラグがtrueの場合にtrue |
フラグがfalseの場合にtrue |
フラグの内容 |
adjacent-to-enemy? |
not-adjacent-to-enemy? |
敵に隣接していますか |
attacked? <movetype> |
not-attacked? <movetype> |
敵によって攻撃されていますか |
defended? <movetype> |
not-defended? <movetype> |
味方によって防御されていますか |
empty? |
not-empty? |
空いていますか |
enemy? |
not-enemy? |
敵の駒ですか |
friend? |
not-friend? |
味方の駒ですか |
(piece? <piece-type>) |
(not-piece? <piece-type>) |
駒は<piece-type>ですか |
on-board? |
not-on-board? |
盤上ですか |
(in-zone? <zone>) |
(not-in-zone? <zone>) |
位置は<zone>内ですか |
(position? <position>) |
(not-position? <position>) |
位置は<position?>ですか |
marked? |
not-marked? |
マークされている位置ですか |
goal-position? |
not-goal-position? |
ゴールになっている位置ですか |
last-from? |
not-last-from? |
前回の手番で動した駒の移動前の位置ですか |
last-to? |
not-last-to? |
前回の手番で動した駒の移動後の位置ですか |
neutral? |
not-neutral? |
ニュートラルですか? |
- ユーザーフラグ(設定できるフラグ):(flag? <flag-name>)
フラグがtrueの場合にtrue |
フラグがfalseの場合にtrue |
フラグをtrue/falseへ設定 |
(position-flag? <flag-name>) |
(not-position-flag? <flag-name>) |
(set-position-flag <flag-name> <bool>) |
(flag? <flag-name>) |
(not-flag? <flag-name>) |
(set-flag <flag-name> <bool>) |
- attribute(駒の属性):<attribute>
フラグがtrueの場合にtrue |
フラグがfalseの場合にtrue |
フラグをtrue/falseへ設定 |
piece内での初期設定 |
<attribute> |
(not <attribute>) |
(set-attribute <attribute> <bool>) |
(attribute <attribute> <bool>) |
位置を指定しない場合、attributeは現在地の駒の属性がtrueかfalseかを返します。
attributeは指定された位置(position)にある駒の属性がtrueかfalseかを返します。
「(not <attribute>)」では、attributeの値が反転します。
- フラグの寿命は移動ブロック内であり、その手番が終わると初期化されますが、
attributeは駒の属性であり、手番を超えて各駒ごとに保存されます。
最終更新:2020年08月28日 16:24