Ludii Forum
Pieces not showing on the board - 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: Pieces not showing on the board (/showthread.php?tid=424)



Pieces not showing on the board - fbarbe - 02-08-2021

Hi,

I am experiencing a very weird behaviour.
I am trying to write the beautiful game "Shobu", which originally has 4 separate 4x4 boards but I decided to implement it with 1 8x8 board.

The initial placement is:
Code:
(place "Ball1" (union (sites Bottom) (sites Row 4)))
(place "Ball2" (union (sites Top) (sites Row 3)))
This gave me the expected output when compiling it the first time.

I then tried to write the first part of the move, which is to move a piece from "your" board. In this case I was just testing this for P1, so I wrote
Code:
(move Step
    (from (sites Occupied by:Mover))
    Forward
    (to if:(is Empty (to)))
    (then (moveAgain))
)
When compiling the game again, no pieces were shown on the board.
After clicking on "Analysis" on the top bar, the status prints the following errors

Code:
VC_ERROR: Error detected when attempting to draw COMPONENTS
VC_ERROR: Error detected when attempting to draw POSSIBLEMOVES

and the "status", "rules", etc... info on the right side all disappeared.

What is going on?

Kind Regards,
Fabio

Unrelated to this problem - but I thought that it might be useful to introduce a "step" parameter to (move Slide) to limit how far the piece can go


RE: Pieces not showing on the board - Eric Piette - 02-08-2021

Hi,

The step move needs a single location to work.
But here you have "(from (sites Occupied by:Mover))"
Which is a regionFunction.

I modified a bit the code in our dev version to return an empty set of moves if no single site is provided to the step move. 
So the error you got right now in doing that will not be there in the next release.

However for your description, you should use a piece generator in the pieces (so describing the moves of the pieces in the (piece ...) ludeme and using (forEach Piece ...) in the playing rules.
You can read examples in many game descriptions. The simplest one is maybe Breakthrough.

----

For the limit in Slide, we already have that.
You need to describe it in the (between ...) part
(move Slide (between (max <IntFunction>)))

All the ranges are handled with RangeFunction, and for such moves you can describe them inside the (between ...) part.

Regards,
Eric


RE: Pieces not showing on the board - fbarbe - 02-08-2021

Thank you a lot for your answer.

Regarding the (move Slide) ludeme, is it normal that I cannot "force" a (to) position with it? The second part of the move in Shobu mimics the first one, and I would expect this code to force the piece to only one location.
Code:
(move Slide
    (from (site))
    (to (+ (site) (- (last To) (last From))))
)
However the (to) condition does not seem to influence the move at all, and the piece can slide to all directions.

Am I doing anything wrong? I have attached the updated version of my code.

Thanks in advance,
Fabio


RE: Pieces not showing on the board - Eric Piette - 02-09-2021

Hi,

Yes that's normal.
A slide move is defined with a 'from' position, a set of directions, a condition to cross sites. More conditions can be added like a stop condition or a range for the distance to move for example.

But whatever you will put as a RegionFunction or IntFunction in the (to ...) part of slide will not modify the behavior.

I advise you to look at the LGLG: https://ludii.games/downloads/LudiiGameLogicGuide.pdf
The section 4.3.9.13 is about slide moves.

Regards,
Eric