11-13-2021, 07:54 PM
(This post was last modified: 11-13-2021, 07:57 PM by sharmoni.
Edit Reason: added attachment
)
Problem solved!
I took another look at the "CaptureToPieceAndResetCounter" from Chess.lud and realized I could use Counter as a flag:
I added the define to "ColumnHop":
So I now have a define to check for capture:
And I can use it in the "ColumnHopSequence" to make #3 null (that avoids moveAgain and stops the hop sequence):
It seems to work, and the only unintended consequence I've found so far is not allowing multiple hops for the Column on the first move of a game. Since multiple hops for the Column on first game move can only occur in Sandbox and not in legal game play, it's an acceptable solution.
I took another look at the "CaptureToPieceAndResetCounter" from Chess.lud and realized I could use Counter as a flag:
Code:
(define "CaptureToPieceAndResetCounter"
(apply
(if ("EnemyCanBeCaptured")
(remove
(to)
(then (set Counter))
)
)
)
)
I added the define to "ColumnHop":
Code:
(define "ColumnHop"
(move
Hop
(from #1)
#2
(to if:(and
"EmptyOrEnemyOccupied"
(not (is Visited (to)))
)
"CaptureToPieceAndResetCounter"
)
#3
)
)
So I now have a define to check for capture:
Code:
(define "DidNotCapture" (!= (counter) -1))
And I can use it in the "ColumnHopSequence" to make #3 null (that avoids moveAgain and stops the hop sequence):
Code:
(define "ColumnHopSequence"
("ColumnHop"
#1
#2
(then
(if
(and
"DidNotCapture"
(can Move ("ColumnHop" (last To) #2))
)
#3
)
)
)
)
It seems to work, and the only unintended consequence I've found so far is not allowing multiple hops for the Column on the first move of a game. Since multiple hops for the Column on first game move can only occur in Sandbox and not in legal game play, it's an acceptable solution.