Ludii Forum
Help with Oust - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: Help with Oust (/showthread.php?tid=242)

Pages: 1 2


Help with Oust - Michael - 11-08-2020

I know it is ill-adviced to code without testing often. But I am seldom at my computer, so I have written a .lud for Oust entirely on my phone (this is especially stupid, since I am using ludemes I have no experience with).

I was looking forward to trying to run it and go through possible mistakes one by one, but I immediately met one of those incomprehensible error-messages that consists of a lot of html code. So I was stuck immediately.

Would it be possible to identify what is causing the error message?

Edit: The error message seems to have been caused by the lack of curly brackets around "(to)" in
Code:
(define "NewGroup"
    (union
        (sites {(to)})
        ("GroupsAround" Mover (to))
    )
)

I have updated the attachment. Now the problem is that "CanCapture" doesn't work as I intended. Sites where a placement would result in a capture are not playable.

I’ll update this post as I figure out more about what is wrong:
  • "GroupsAround" seems to work as intended, so I no longer think the problem is with my use of (is Connected).
  • I think it is correct now. I used (do … ifAfterwards:) instead of my defines. 



RE: Help with Oust - AlekErickson - 11-08-2020

in (play) I commented out lines like this

(play
            (move Add
                (to
                    (forEach
                        (sites Empty)
                        if:(      // or
                            ("NoFriendlyAdjacent")
    //                      ("CanCapture")
                        )
                    )
                )
    //          (then
    //              (if ("CaptureMove")
    //                  (and
    //                      ("RemoveGroups")
    //                      (moveAgain)
    //                  )
    //              )
    //          )
            )
        )


and ran the file. It compiles, but it doesn't work properly because players are somehow still able to play adjacent to friendlies.


RE: Help with Oust - Michael - 11-08-2020

That's a mistake in "NoFriendlyAdjacent". "(to)" should be "(site)". Like this:

Code:
(define "NoFriendlyAdjacent"
    (=
        0
        (count Sites in:(sites Around (site) Own))
    )
)

It seems the error is caused by "CanCapture". It compiles if I change the to-parameter in (move Add) to
Code:
                (to
                    (forEach
                        (sites Empty)
                            if:("NoFriendlyAdjacent")
                    )
                )
and leave everything else as is. But "CanCapture" calls "GroupsAround", "NewGroup" and "forAllSites", so it doesn't narrow it down much. My guess is that the problem is with the use of (is Connected) in "GroupsAround", because I have never used this ludeme. I must experiment with it to see how it is supposed to work.

Edit: Ah! I forgot the curly brackets in "(sites {(to)})" in "NewGroup". It compiles with them, but I have made a mistake somewhere. I am not allowed to capture.. Still guessing I'm misunderstanding (is Connected).


RE: Help with Oust - AlekErickson - 11-08-2020

ok, just let me know when it's working :D
or , send a lud in progress if you get stuck.


RE: Help with Oust - Eric Piette - 11-09-2020

Hi,

I just tried the .lud you have in the first message and it works (compilation and play) in our dev version.
Do you have still any problem with it?

Regards,
Eric


RE: Help with Oust - Michael - 11-09-2020

(11-09-2020, 08:52 AM)Eric Piette Wrote: Hi,

I just tried the .lud you have in the first message and it works (compilation and play) in our dev version.
Do you have still any problem with it?

Regards,
Eric
Capture moves do not show up as legal. Can you capture in the dev version?


RE: Help with Oust - Eric Piette - 11-09-2020

Hi,

I did not look the rules or the description itself, just if the game was "working" in the sense compilation and no bug during the play because of the first message with: "those incomprehensible error-messages that consists of a lot of html code".

Do you also need help for something else?

Regards,
Eric


RE: Help with Oust - Michael - 11-09-2020

I don’t have a conrete question. I’m trying to figure out what mistake I have made. I will post here when I have an easier question than «what’s wrong?».

As it happens, I already have a slightly better question. There seems to be something wrong with ("NewGroup"). I have attached a .lud where the intention is that one can place at a site if the stone one places thereby becomes part of a group of size 3. I don't understand what I am doing wrong. Could you help me with this?


RE: Help with Oust - Eric Piette - 11-09-2020

Hi,

I did not check exactly what you did in your file, but based on it I did it differently in using the ludeme (do ...) which is one of the reason for it to be.

Code:
(game "NewGroupTestMuchEasier"
    (players 2)
    (equipment
        {
            (board (hex 4))
            (piece "Ball" Each)
        }
    )
    (rules
        (start {
            (place "Ball1" {17 23 22 25 7 3})
            (place "Ball2" {24 29 35 1})
        })
        (play 
            (do
               (move Add (to (sites Empty)))
               ifAfterwards:(= 3 (size Group at:(last To)))
             )
        )
        (end (if (no Moves Next) (result Mover Win)))
    )
)

You can try, that works.

Is it helpful?

Regards,
Eric


RE: Help with Oust - Michael - 11-09-2020

(11-09-2020, 12:56 PM)Eric Piette Wrote: Is it helpful?
It doesn't lift the confusion over why ("NewGroup") doesn't work, but it is absolutely helpful!

It is also a bit frustrating, however, because I tried to implement Oust using (do … ifAfterwards:) but ran into that incomprehensible error message. I assumed it was because (do) only worked with nondecision moves. That's why I wrote a relatively elaborate workaround. Now that I know that it should work (that my error was elsewhere), I can rewrite things.