Ludii Forum
(forEach Site Vertex/Cell (...)) - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Grammar Problems (https://ludii.games/forums/forumdisplay.php?fid=24)
+--- Thread: (forEach Site Vertex/Cell (...)) (/showthread.php?tid=486)



(forEach Site Vertex/Cell (...)) - dale walton - 03-05-2021

(forEach Site Vertex/Cell (...))

I am having problems with
(or
 (forEach Site  (sites Empty Vertex) (move add (to (site)))
 (move Select
  (from Cell (sites Board Cell))
  (to Cell (sites Around (from) OffDiagonal)
  (then
   (forEach Site
     (sites Incident Vertex of:Cell at:(last From))
       ... anything based on (site)...
)))))

I can Add, I can Select, but the system makes an Add move instead of whatever is in the "anything"  (the moves shows the result as the Add move performed, and the Select choices and  Variables set or other actions  in anything are not recorded event though I was able to make both selections.

I was wondering if the (forEach needs to know that it is handling Vertex in both cases,
However
(forEach Site Vertex/Cell (...)) is not implemented

This was on a tri-grid  with use:Vertex.   

My intent is to move some pieces on some Vertex based upon the selected Cells of the grid.

I found the problem more specifically: it has to do with OffDiagonal selections  When Adjacent is specified, the program worked for the Orthogonal selections but not for the OffDiagonal selections.

Since the actual program is a bit more complicated, I will clean it up a bit to just show the bug, if you cannot find it from what info I have given.


RE: (forEach Site Vertex/Cell (...)) - Eric Piette - 03-05-2021

Hi,

Can you provide a short .lud showing only that problem?

Regards,
Eric


RE: (forEach Site Vertex/Cell (...)) - dale walton - 03-05-2021

A simple one? It will take a while to pare all the trash away from what I enclosed, but the problem is I probably don't understand what the bug is, so that might not succeed.

So, Instead of second guessing which isn't helpful at all,  I am attaching the current mess that compiles and behaves randomly, and these errors that showed in the terminal when I opened up the expanded editor. Also the the contents of the expanded editor. Note: I don't use it for editing - just to see how ludii understands my defines.


WARNING: no type doc for subclass metadata.graphics.util.BoardGraphicsType of abstract type metadata.MetadataItem!
WARNING: no type doc for subclass game.util.directions.CompassDirection$1 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$10 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$11 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$12 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$13 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$14 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$15 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$16 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$2 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$3 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$4 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$5 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$6 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$7 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$8 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.CompassDirection$9 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.RotationalDirection$1 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.RotationalDirection$2 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.RotationalDirection$3 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.RotationalDirection$4 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.RotationalDirection of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$1 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$10 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$11 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$12 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$13 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$14 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$15 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$16 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$17 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$18 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$2 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$3 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$4 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$5 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$6 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$7 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$8 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection$9 of abstract type game.util.directions.DirectionFacing!
WARNING: no type doc for subclass game.util.directions.SpatialDirection of abstract type game.util.directions.DirectionFacing!

Update

I had been working on simplifying the file, but actually compiling the one I sent you.

I now find: It is perfoming the select but not the subsequent action, instead it does one of 2 things (randomly? - but I can use (priority to determine which) it either selects one of the nearest Vertecies to the (to0 Cell and does an Add their, or it shows a movement arro from the from Cell to the to Cell and records the first variable assignment.


RE: (forEach Site Vertex/Cell (...)) - Eric Piette - 03-05-2021

Hi,

I tested your 2 files and I did not get any problem with them, so still not sure what you are asking.

Concerning the editors (packed or not) they are printing in the terminal a lot of stuff which are useful for the developers of it in which I am not included. This is just information for them, so not related to any problem you can have. Here that's just warnings about some classes in which the grammar is not found, which is something we know but not causing any problem, just warning we print for us to know.

Regards,
Eric


RE: (forEach Site Vertex/Cell (...)) - dale walton - 03-05-2021

Update 2. Success on the priority to Plow version by changing:

  (then
  (set Var "PlowFrom" (last From)
    (then
    (set Var "PlowTo" (last To)
      (then

to:


  (then
  (and
    (set Var "PlowFrom" (last From))
    (set Var "PlowTo" (last To))
    (then

So why does the first version not work: the variables have different names?

This also means that in the former case the second  (set and its consequences were not executed, and so there was only the first set to record.  But raises the question of why the program often chose to MIX the moves (even on my versions where I did not  place the move definition in the Piece definition)


RE: (forEach Site Vertex/Cell (...)) - Eric Piette - 03-05-2021

Hi,

Thanks for that. The reason is because in the current version, the consequences moves of a (set Var ...) were ignored. I fixed that in our dev version, so should be fixed with the next release.

Regards,
Eric


RE: (forEach Site Vertex/Cell (...)) - dale walton - 03-05-2021

Separate issue, same program.

It appears that  (difference ("DozerLocation" #1) ("DozerLocation" #2)) is not choosing the correct two sites, it is including the intersection value. -- is it possible that the items are excluded out of sequence ...?

However the problem is not with "difference", remembering the values at the same time as the set value statements gives the correct result.


-----------------------------------------
I will just look for a work around...