02-21-2021, 05:49 AM
(This post was last modified: 02-21-2021, 06:57 AM by dale walton.)
In a version of Equi I am now getting:
WARNING: Move [[SetScore:player=1,score=-10,add=true], [SetPending:value=28], [Move:typeFrom=Cell,from=27,typeTo=Cell,to=29,decision=true], [RememberValue:name=nullvalue=28], [SetPending:], [SetNextPlayer:player=2], [Remove:type=Cell,to=28], [SetPending:], [SetNextPlayer:player=2], [Add:type=Cell,to=28,what=4], [SetPending:], [SetNextPlayer:player=2], [SetScore:player=2,score=10,add=true], [SetPending:], [SetNextPlayer:player=2]] is duplicated in the legal moves.
When a second hop is taken. It appears to be coming from the (moveAgain) at the bottom of this define:
(define "GeneralHop" // argument where from, who's sites, piece type hopped, piece typ replaced
(forEach Piece "Disc"
(move Hop #1
(between
if:(is
In
(between)
(difference
(intersection
#2
(sites Occupied by:All component:#3)
)
(sites (values Remembered))
))
(apply
(and
(addScore (player (who at:(between))) (- #5))
(set Pending (between))
)))
(to if:(is Empty (to)))
)
(then
(and
{
(remember Value (value Pending))
(remove (value Pending))
(if #7
(and
(add (piece (id #4 Mover)) (to (value Pending)))
(addScore Mover #6)
))
}
(then
(and
(set Pending)
(moveAgain)
))))))
When I change to:
(then
(set Pending
(then (moveAgain))
The moveAgain does not execute.
When I change to
(then
(moveAgain (then (set Pending)))
I get a syntax error.
I have seen before that (and () () (then ...) causes duplicated execution of the contents in the then. Usually this doesn't matter (except for slowing things down, but sometimes it does. In this case, your new warning has detected it.
Is it executing the (then as both an element of the (and, and as a proper (then) ?
Or, as I suspect is it executing one copy of the (then) for each of the moves in the (and) 9in this case there are 3 or 4 moves under the and, depending how the (and) nested inside the (if) is treated. - and there are 4 executions of the (set Pending)+(moveAgain)
WARNING: Move [[SetScore:player=1,score=-10,add=true], [SetPending:value=28], [Move:typeFrom=Cell,from=27,typeTo=Cell,to=29,decision=true], [RememberValue:name=nullvalue=28], [SetPending:], [SetNextPlayer:player=2], [Remove:type=Cell,to=28], [SetPending:], [SetNextPlayer:player=2], [Add:type=Cell,to=28,what=4], [SetPending:], [SetNextPlayer:player=2], [SetScore:player=2,score=10,add=true], [SetPending:], [SetNextPlayer:player=2]] is duplicated in the legal moves.
When a second hop is taken. It appears to be coming from the (moveAgain) at the bottom of this define:
(define "GeneralHop" // argument where from, who's sites, piece type hopped, piece typ replaced
(forEach Piece "Disc"
(move Hop #1
(between
if:(is
In
(between)
(difference
(intersection
#2
(sites Occupied by:All component:#3)
)
(sites (values Remembered))
))
(apply
(and
(addScore (player (who at:(between))) (- #5))
(set Pending (between))
)))
(to if:(is Empty (to)))
)
(then
(and
{
(remember Value (value Pending))
(remove (value Pending))
(if #7
(and
(add (piece (id #4 Mover)) (to (value Pending)))
(addScore Mover #6)
))
}
(then
(and
(set Pending)
(moveAgain)
))))))
When I change to:
(then
(set Pending
(then (moveAgain))
The moveAgain does not execute.
When I change to
(then
(moveAgain (then (set Pending)))
I get a syntax error.
I have seen before that (and () () (then ...) causes duplicated execution of the contents in the then. Usually this doesn't matter (except for slowing things down, but sometimes it does. In this case, your new warning has detected it.
Is it executing the (then as both an element of the (and, and as a proper (then) ?
Or, as I suspect is it executing one copy of the (then) for each of the moves in the (and) 9in this case there are 3 or 4 moves under the and, depending how the (and) nested inside the (if) is treated. - and there are 4 executions of the (set Pending)+(moveAgain)