| Author |
Message |
Tony Britton (Captain)
New member Username: Captain
Post Number: 18 Registered: 12-2009
| | Posted on Monday, March 15, 2021 - 7:46 pm: | |
Is it possible to change a pieces move-type during the game? |
Shigeki Watanabe (Watanabe)
New member Username: Watanabe
Post Number: 44 Registered: 3-2018
| | Posted on Thursday, March 18, 2021 - 2:07 am: | |
No, you can not change the "move-type" of a piece during the game. Because the "move-type" of a piece is static parameter. |
Shigeki Watanabe (Watanabe)
New member Username: Watanabe
Post Number: 45 Registered: 3-2018
| | Posted on Thursday, March 18, 2021 - 2:13 am: | |
But you can replace it in another way. First, set multiple "move-types" in a piece. And make it available by different "attribute" in a piece. That way, you can use different "move-types" by changing the attribute" of a piece. |
Shigeki Watanabe (Watanabe)
New member Username: Watanabe
Post Number: 46 Registered: 3-2018
| | Posted on Thursday, March 18, 2021 - 2:27 am: | |
(name Piece1) (attribute move-type-A? true) (moves (moveX) (move-type typeA) (moveA n) (move-type typeB) (moveB n) ) (define moveX (if move-type-A? (set-attribute move-type-A? false) add else (set-attribute move-type-A? true) add ) (define moveA (verify move-type-A?) add $1 ) (define moveB (verify (not move-type-A?) ) add $1 ) (name Piece2) (moves (move-type typeC) (moveC n s e w) ) (define moveC (if (attacked? typeA) (if (attacked? typeB) add $1 else add $2 ) else (if (attacked? typeB) add $3 else add $4 ) ) ) |
Astrit Bardhi (Aepasa) New member Username: Aepasa
Post Number: 40 Registered: 1-2007
| | Posted on Wednesday, March 24, 2021 - 1:34 am: | |
Hi, Very nice! Cheers, Astriti |
Tony Britton (Captain)
New member Username: Captain
Post Number: 20 Registered: 12-2009
| | Posted on Thursday, April 01, 2021 - 12:27 pm: | |
That is very nice. Thank you!!I solved the problem with the pin move not letting a piece move from the point of the pin as when skewered. By adding a counter move that only lets you move on the pin line. A pin defensive move. (define Bishop-PD-D1-slide ( (set-flag pinned-D1? false) mark (pin-D1 D1-line ne sw) (verify (flag? pinned-D1?) ) $1 (while empty? add $1) (verify not-friend?) (king-capture $2) (Display-Piece $3) add ) ) This way the piece can move toward the enemy piece to capture or away to a stronger position to defend. Thank you, again for all your help. I am now on to trying to construct a post partial-add move that only lets you check to see if your king is in check or not. So far I am having some trouble getting the while on board part figured out. (define legal-move (if (piece? White?) mark (King-Status Northern? $1) back else (if (piece? Black?) mark (King-Status Southern? $1) back ))) (define King-Status mark North (while (on-board? e) (if $1 (King-attacked $2 )e)) N7W1 (while (on-board? e) (if $1 (King-attacked $2 )e)) ETC,ETC (define King-attacked (if (and (piece? White-King) (not-attacked? true)) (set-flag White-King attacked? false) (if (not-empty? N6E4) (capture N6E4)) ) else (if (and (piece? White-King) (not-attacked? false)) (set-flag White-King attacked? true) (if (empty? N6E4)(create White-light N6E4)) ) else (if (and (piece? Black-King) (not-attacked? true)) (set-flag Black-King attacked? false) (if (not-empty? S6W4)(capture S6W4 )) ) else (if (and(piece? Black-King) (not-attacked? false)) (set-flag Black-King attacked? true) (if (empty? S6W4)(create Black-light S6W4)) ) (define leap22 ( $1 $2 (verify not-friend?) (Display-Piece $3) (add-partial King-Status-type) (legal-move $4) (if (flag? attacked? true)(go last-from)) (if (flag? attacked? false)) add ) ) I can get the macros to load, but I am having trouble getting them to work. Always in the (while on board) section. Any helpful solutions would be welcome. Thank you again!! |