Ludii Forum
(board (square (poly ... problem - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: (board (square (poly ... problem (/showthread.php?tid=117)



(board (square (poly ... problem - dale walton - 08-09-2020

Documentation shows:
(square (poly { { 1 2} { 1 6 } { 3 6 } { 3 4 } { 4 4 } { 4 2 } }))  as arguments for (board ...

My code:
(define "Order2" (poly { { 1 3 } { 2 2 } { 4 1 } { 5 2 } { 6 4 } { 5 5 } { 3 6 } { 2 5 } } ))
(option "Board Size" <Board> args:{ <ord> }
{
(item "Muster 2" <"Order2"> "Board: Muster order 2 board - 20 positions")*

...
}
(game "Make Muster"
  (players 2)
  (equipment
    {(board (square <Board:ord> diagonals: Solid))

...

Result:

language.compiler.exceptions.CompilerException: Unexpected syntax '(square (poly {{1 3} ...' in '(board (square (poly {{1 3} {...'.

What went wrong?

I also had problems with the below, where <Board:ord> was an integer:

//(define "BoardShape"
// (poly
//  {
//  { 1 (+ 2 <Board:ord>) }
//  { 2 (+ 1 <Board:ord>) }
//  { (* 2 (+ 2 <Board:ord>)) 1}
//  { (+ 1 (* 2 (+ 2 <Board:ord>))) 2 }
//  { (* 3 <Board:ord>) (* 2 (+ 2 <Board:ord>)) }
//  { (- (* 3 <Board:ord>) 1 ) (+ 1 (* 2 (+ 2 <Board:ord>))) }
//  { (+ 2 <Board:ord>) (* 3 <Board:ord>) }
//  { (+ 1 <Board:ord>) (- (* 3 <Board:ord>) 1 ) }
//  }
// )
//)

poly didn't treat the result of an addition as an integer in the integer pairs:

Failed to parse game description:
* Unexpected syntax '(+ 2 2)' in '{1 (+ 2 2)}'.
Unexpected syntax '(+ 2 2)' in '{1 (+ 2 2)}'.

language.compiler.exceptions.CompilerException: Unexpected syntax '(+ 2 2)' in '{1 (+ 2 2)}'.


RE: (board (square (poly ... problem - Eric Piette - 08-09-2020

I just made that test

Code:
(define "Order2" (poly { { 1 3 } { 2 2 } { 4 1 } { 5 2 } { 6 4 } { 5 5 } { 3 6 } { 2 5 } } ))

(game "example" 
    (players 2) 
    (equipment {
        (board (square <Board:ord> diagonals:Solid))
        (piece "Disc" P1)
        (piece "Cross" P2)
    }) 
    (rules
        (play (move Add (to (sites Empty))))
        (end
           (if (is Line 3) (result Mover Win))
        )
    )
)

(option "Board Size" <Board> args:{ <ord> }
{
  (item "Muster 2" <"Order2"> "Board: Muster order 2 board - 20 positions")*
}
)


And that works. So not sure what is your problem here. Can you send us a more complete version to identify your problem?

For your second question, yes, in the current version, only integers can be used in the ludemes available in the equipment, no IntFunction (even the mathematical ones (+, -, *, /) are not possible to use in the graph functions to build the board).


RE: (board (square (poly ... problem - dale walton - 08-10-2020

Maybe a space before "Solid"?


RE: (board (square (poly ... problem - Eric Piette - 08-10-2020

oh yeah. No space between the ':' and the parameter.


RE: (board (square (poly ... problem - dale walton - 08-11-2020

Im also getting a funny result on diagonals:Solid - sometimes showing, sometimes not. When showing, the (from) have shifted from the centers of the square cells to the centers of the 4 triangles inside them. -- I just want to graphically show the diagonals, not switch the logic.

An aside. - Is there a way to create our own cell images and/or board images using svg files?


RE: (board (square (poly ... problem - cambolbro - 08-11-2020

Hi,

> // (poly
> // {
> // { 1 (+ 2 <Board:ord>) }

The problem is that (poly ...) takes pairs of floats, but you're providing an int function parameter. We should be able to make these pairs of float functions, which should do the trick.

> Is there a way to create our own cell images and/or board images using svg files?

No.

Regards,
Cameron


RE: (board (square (poly ... problem - dale walton - 08-11-2020

I take your word for it.  They look like integers, and don't need to be floats (just avoid division in the implementations..)

On the topic of poly: attached is a (hex (poly { { 1 3 } { 5 1 } { 14 8 } { 16 14 } { 10 17 } { 4 13 } } ))
image that doesn't seem correct - How are the coordinates of a hex grid defined?


RE: (board (square (poly ... problem - cambolbro - 08-11-2020

Hi,

How are the coordinates of a hex grid defined?
Use View > Show Coordinates to see the coordinate system in place.

But that's not relevant, the poly coordinates are just (x,y) coordinates on a square grid.

Regards,
Cameron


RE: (board (square (poly ... problem - dale walton - 08-12-2020

OK... but where are the coordinates and spacing of the hex grid generator on that square grid so that I can sensibly define the bounding region that I want. And, for example, can I center the board poly region on the origin (0 0), or does the entire poly region need to be positive, etc.

For defining board regions by coordinates, and removing cells, etc. it would be easier if the points of the limits were board coordinates (eg {"B10" ...} than related to coordinates that are not visible to the game developer.