04-12-2023, 02:06 AM
(This post was last modified: 04-12-2023, 02:11 AM by dale walton.)
The documentation shows if is valid for booleans. I have had problems with it sometimes, but in theory:
(define "OnePawnPerColumn"
(if
(= 0 (% #1 2)) // #1 is even
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Row (row of:(to)))))
)
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Column (column of:(to)))))
) ) )
If not, you could use:
(define "OnePawnPerColumn"
(or
(and
(= 0 (% #1 2)) // #1 is even
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Row (row of:(to)))))
) )
(and
(= 1 (% #1 2)) // #1 is odd
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Column (column of:(to)))))
) ) ) )
(define "OnePawnPerColumn"
(if
(= 0 (% #1 2)) // #1 is even
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Row (row of:(to)))))
)
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Column (column of:(to)))))
) ) )
If not, you could use:
(define "OnePawnPerColumn"
(or
(and
(= 0 (% #1 2)) // #1 is even
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Row (row of:(to)))))
) )
(and
(= 1 (% #1 2)) // #1 is odd
(=
(count Sites in:(sites Occupied by:#1 container:"Board" component:"Fuhyo"))
(count Sites in:(difference (sites Occupied by:#1 container:"Board" component:"Fuhyo") (sites Column (column of:(to)))))
) ) ) )