Ludii Forum
(sites Distance) bug? - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Game Problems (https://ludii.games/forums/forumdisplay.php?fid=17)
+--- Thread: (sites Distance) bug? (/showthread.php?tid=758)



(sites Distance) bug? - Michael - 11-28-2021

I'm having trouble with the attached file, but you may ignore everything except the (note)-ludeme. It's supposed to print the sites
Code:
(sites Distance
    (step (to if:(= (id Neutral) (who at:(to)))))
    from:(centrePoint)
    (range 2)
)
But prints {}. This region should not be empty.

It works if I change the range to (range 1), but I can't get any bigger numbers to work. What's happening here?

Edit: Attachments don't work. Or, there is no button to attach.. I'll attach the file when this is fixed.

Oh, it seems I reported the exact same bug here: https://ludii.games/forums/showthread.php?tid=645&pid=2862#pid2862

I guess the problem is back, then..


RE: (sites Distance) bug? - Eric Piette - 11-29-2021

Hi,

It does not seem to be the same problem. The one in the other post was not using a step move + you were using (exact 2).

For this one, because you are using a step one, I would need the .lud file from you before to take a look. Can you submit it?
Or is it a bug there to and Matthew should take a look to fix the attach button?

Regards,
Eric


RE: (sites Distance) bug? - Michael - 11-29-2021

There is a button missing from the forum interface.. I can choose the file, but then I need to attach it to the post, and there is no option to perform this last step. I can post the entire script in a code tag here, but as I said, the problem is illustrated fully inside (note), which is the bit I quoted in the last post. And I'm actually using (exact) in this game, I just used (range) inside (note) when I wanted to pinpoint the issue.

Code:
(define "DistanceToNearestIceberg"
    (count Steps
        ("OntoEmptyOrIceberg")
        (from)
        (sites Occupied by:Neutral)
    )
)

(define "NearestIcebergs"
    (intersection
        (sites Occupied by:Neutral)
        (sites Distance
            ("OntoEmptyOrIceberg")
            from:(from)
            (exact ("DistanceToNearestIceberg"))
        )
    )
)

(define "OntoEmptyOrIceberg"
    (step
        (to
            if:(or
                (= (id Neutral) (who at:(to)))
                (is Empty (to))
            )
        )
    )
)

(game "Icebreaker"
    (players 2)
    (equipment
        {
            (board (hex 5))
            (piece "Disc" Each
                (move Step
                    (to
                        if:(and
                            (or
                                (= (id Neutral) (who at:(to)))
                                (is Empty (to))
                            )
                            (= 1
                                (-
                                    (count Steps
                                        ("OntoEmptyOrIceberg")
                                        (from)
                                        ("NearestIcebergs")
                                    )
                                    (count Steps
                                        ("OntoEmptyOrIceberg")
                                        (to)
                                        ("NearestIcebergs")
                                    )
                                )
                            )
                        )
                        (apply
                            (if
                                (= (id Neutral) (who at:(to)))
                                (and
                                    (remove (to))
                                    (addScore Mover 1)
                                )
                            )
                        )
                    )
                )
            )
            (piece "Disc" Neutral)
        }
    )
    (rules
        (start {
            (place "Disc0" (difference (sites Board) (sites Corners)))
            (place "Disc1" (intersection (sites Corners) (sites Phase 0)))
            (place "Disc2" (intersection (sites Corners) (sites Phase 1)))
        })
        (play
            (forEach Piece Mover
                (then
                    (note
                        (sites Distance
                            (step (to if:(= (id Neutral) (who at:(to)))))
                            from:(centrePoint)
                            (range 2)
                        )
                    )
                )
            )
        )
        (end
            (if
                (no Pieces Neutral)
                (byScore)
            )
        )
    )
)

(metadata
    (graphics {
        (player Colour Neutral (colour White))
        (player Colour P1 (colour Red))
        (player Colour P2 (colour Black))
    })
)

Edit: Oh, nice. This time the file was actually attached.


RE: (sites Distance) bug? - Eric Piette - 11-29-2021

Hi,

I found the problem and fixed it. That will be in the next release.

Regards,
Eric


RE: (sites Distance) bug? - Michael - 01-08-2022

Any idea when the next release is comming?


RE: (sites Distance) bug? - Eric Piette - 01-10-2022

Hi,

We are waiting for Matthew to come back from his holidays.

He is coming back next week, so probably during the next week.

Regards,
Eric