「add」時に、その位置にある駒の駒属性<attribute>を「true」または「false」に変更します。
(moves <move-def>)内で、移動時に元の駒属性<attribute>の値を上書きします。
駒の移動が終わっても、その駒が除去されるまで、ゲーム中ずっと保持されます。
現在位置の駒属性<attribute>を変更するため、「add」の直前で変更するのが安全です。
(移動している駒の場合、移動先で駒属性<attribute>を変更します)
「if」で分岐する場合、分岐文内で「add」1個につきそれぞれ「set-attribute」が必要です。
(verify <condition>)や(if <condition> <instruction>)で、駒属性<attribute>をフラグのように参照できます。
(verify <attribute>)や(if <attribute> <instruction>)として、(moves <move-def>)内で移動時に利用できます。
- (set-attribute <attribute> <condition>)
<condition>には「true」または「false」が入ります。
- (set-attribute <attribute> true):
<attribute>の初期値を「true」に変更します。
- (set-attribute <attribute> false)
<attribute>の初期値を「false」に変更します。
①
(game
(piece
(attribute never? true)
)
)
②
(moves
(
(if never?
e add
else
w add)
)
)
③
(moves
(
n
(verify (not never?))
add
)
)
④
(moves
(
s
(set-attribute never? false)
add
)
)
※<attribute>が「true」かどうかを判定する場合は、<attribute>そのままで使用します。
※<attribute>が「false」かどうかを判定する場合は、(not <attribute>)として使用します。
最終更新:2020年08月29日 02:36