Ludii Forum
Miscellaneous bugs and misunderstandings of the grammar - Printable Version

+- Ludii Forum (
+-- Forum: Problems (
+--- Forum: Grammar Problems (
+--- Thread: Miscellaneous bugs and misunderstandings of the grammar (/showthread.php?tid=142)

Miscellaneous bugs and misunderstandings of the grammar - dale walton - 08-19-2020

Over the hump of the learning curve, but getting a mix of misunderstanding / missing sintax / and program bugs.  Example from some testing I did...

(define "SitesNotOwn" (union (sites Empty) (sites Occupied by:Next)) )

      Unexpected syntax '(union (sites Empty) ...' in '(count Sites (union (sites Em...'.

(define "SitesNotOwn" (sites (difference (sites Board) (sites occupied by:Mover)) ))

      Unexpected syntax '(sites Board)' in '(difference (sites Board) (si...'.(>

as part of:

(define "TestWin2"
    (count Sites ("SitesNotOwn"))
    (count Sites (sites
                  (sites Random "SitesNotOwn" 1 )
                  if:(not (is In (sites Mover)))

      (move Add (to "SitesNotOwn"))
    (end (if ("TestWin2") (result Mover Win)))


===> Ok I found some of these (it seems the errors can be in places not very related, and that some things cause problems:
Adding the missing "in:" solved some problems.
in the "(sites (difference .." removing the redundant "(sites" solved one problem  --- Why should this matter?
in (sites Random "SitesNotOwn" 1 ) removing the  "1" (which is the default) solved another problem  --- Why should this matter?
adding "distance:" solved another.

Also why the objection to  "NotOwn" in the below

(define "TestWin1"
    (count Sites
          (sites Random ("SitesNotOwn") )

Unexpected syntax 'NotOwn' in '(sites Around (sites Random (...'.

What I am trying to do is count all the contiguous sites from a random site in my dynamic region to see it that includes all of the region or not...

---- Should <regionTypeDynamic> be part of the (<int>|<region>) option in the documentation, or does it have a separate purpose that I misunderstood?

For getting sites around another.
(sites Around [typeLoc:<siteType>] (<int> | <region>)
[<regionTypeDynamic>] [distance:<int>] [<absoluteDirection>]
[if:<boolean>] [includeSelf:<boolean>])
• [typeLoc:<siteType>]: The graph element type [Cell (or Vertex if using intersec-
• <int>: The location to check.
• <region>: The region to check.
• [<regionTypeDynamic>]: The type of the dynamic region.
• [distance:<int>]: The distance around which to check.
• [<absoluteDirection>]: The directions to use [Adjacent].
• [if:<boolean>]: The condition to satisfy around the site to be included in the result.
• [includeSelf:<boolean>]: True if the origin site/region is included in the result

Plus the logic is still not working.

RE: Miscellaneous bugs and misunderstandings of the grammar - Eric Piette - 09-06-2020


(sites (difference (sites Board) (sites occupied by:Mover)) )

is incorrect. The correct syntax is just

(difference (sites Board) (sites Occupied by:Mover))


(count Sites ("SitesNotOwn"))

is also incorrect and should be

(count Sites in:("SitesNotOwn"))


After that I am not sure what is your question?

Eric Piette