11-23-2020, 07:30 AM
(This post was last modified: 11-23-2020, 07:36 AM by dale walton.)
I have a game in which individual pieces have an alternative move if they cannot make a standard move.
I attempted a structure of :
(forEach Piece (if (can ("StdMove")) ("StdMove") ("AltMove")))
This produced a syntax error in the "StdMove" define.
However, when the (can ("StdMove")) condition was replaced with an always true, or with an always false condition the program compiled and ran in a consistent manner.
I also tried using a separate define for the (can which used a non-decision version - but that did not help.
See attached file. Note: to compile the file, you will need to change the condition to (= 1 1) or (= 1 2) - as it stands, it does not compile.
I believe that if a move can be made, then it should also work with can. If not, please supply documentation of when and why it cannot be used.
(PS. I also tried to solve this using a construct with "(results" in the condition calculation instead of using a conditional move, but that just blew up with no understandable message, and it presented far more questions of what might be wrong than this method)
I attempted a structure of :
(forEach Piece (if (can ("StdMove")) ("StdMove") ("AltMove")))
This produced a syntax error in the "StdMove" define.
However, when the (can ("StdMove")) condition was replaced with an always true, or with an always false condition the program compiled and ran in a consistent manner.
I also tried using a separate define for the (can which used a non-decision version - but that did not help.
See attached file. Note: to compile the file, you will need to change the condition to (= 1 1) or (= 1 2) - as it stands, it does not compile.
I believe that if a move can be made, then it should also work with can. If not, please supply documentation of when and why it cannot be used.
(PS. I also tried to solve this using a construct with "(results" in the condition calculation instead of using a conditional move, but that just blew up with no understandable message, and it presented far more questions of what might be wrong than this method)