08-19-2020, 08:53 AM
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
Around
(sites Random "SitesNotOwn" 1 )
99
if:(not (is In (sites Mover)))
includeSelf:true
)
)
)
)
...
(rules
(play
(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:
eg
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"
(<
0
(count Sites
in:(difference
"SitesNotOwn"
(sites
Around
(sites Random ("SitesNotOwn") )
distance:99
NotOwn
includeSelf:true
)
)
)
)
)
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>])
where:
• [typeLoc:<siteType>]: The graph element type [Cell (or Vertex if using intersec-
tions)].
• <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
[false].
Plus the logic is still not working.
(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
Around
(sites Random "SitesNotOwn" 1 )
99
if:(not (is In (sites Mover)))
includeSelf:true
)
)
)
)
...
(rules
(play
(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:
eg
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"
(<
0
(count Sites
in:(difference
"SitesNotOwn"
(sites
Around
(sites Random ("SitesNotOwn") )
distance:99
NotOwn
includeSelf:true
)
)
)
)
)
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>])
where:
• [typeLoc:<siteType>]: The graph element type [Cell (or Vertex if using intersec-
tions)].
• <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
[false].
Plus the logic is still not working.