Ludii Forum
Problems implementing Battleship - 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: Problems implementing Battleship (/showthread.php?tid=394)

Pages: 1 2 3 4


RE: Problems implementing Battleship - Eric Piette - 02-22-2021

Hi,

ok so 2 things about (sites LargePiece ...):
1) we had a bug adding sometimes the "what" to the list of the result. That's now fixed.
2) That ludeme is returning all the sites occupied by a large piece in looking the root of the large piece (if that's not the large piece, just the site occupied by that piece). For example for your case:
"(sites LargePiece at:101)" returns "[101,121,141,161,181]" is correct.
However all the others should return [] except for the site 181, because apparently you have some waves pieces there so that one should return 181.

Talking about your description, I am not sure about why you are using waves pieces. That should be just something to do in the graphics and the waves pieces do not seem necessary for that game.

Regards,
Eric


RE: Problems implementing Battleship - slimy_asparagus - 03-03-2021

Eric,

Thank you. It is taking me quite a long time to work through stuff now.

I take your point about "waves" etc. belong rather in the graphics metadata. I am laying that aside until I have got the underlying mechanics working.

So thanks for fixing the issue with the "what" values getting inserted into the output from (sites LargePiece at:X). I notice however that for this ludeme to work X needs to be the root of the piece.

I am not sure if that is how it is supposed to work. However it seems to me that it might be. If that is how it is supposed to work, then that really confirms for me I need to do the Conversion approach. To achieve this I need to shift the move rules into the tile.

However I am getting odd results. In the attached .lud file everything works until I uncomment the following code:

Code:
            (then
                (do
                    (set Var "TileTo" (last To))
                    next:(do
                        (forEach
                            Site
                            (sites LargePiece at:(var "TileTo"))
                            (add (piece (id #3 Mover) ) (to (var "TileTo")) stack:True)
                        )
                        next:(remove (var "TileTo") level:0)
                    )
                )
            )

This is intended to replace the Large piece with the corresponding small pieces.

The attached version works as expected. However if I uncomment this code it breaks. Upon loading I get this:

[Image: pic6022387.png]


RE: Problems implementing Battleship - Eric Piette - 03-03-2021

Hi,

If you remove the stack:True that should work.

Regards,
Eric


RE: Problems implementing Battleship - slimy_asparagus - 03-03-2021

(03-03-2021, 01:18 PM)Eric Piette Wrote: Hi,

If you remove the stack:True that should work.

Regards,
Eric


That seems like a positive step forward that I can probably work with. However I don't understand why you suggested that,


RE: Problems implementing Battleship - Eric Piette - 03-03-2021

Hi,

if you puts Stack:true you are activated the state to be a stacking game, so you create a complete different state for the logic.
And large pieces + stacking is not compatible, that's an exception I will return in the next version to avoid such cases.

Regards,
Eric


RE: Problems implementing Battleship - slimy_asparagus - 03-03-2021

(03-03-2021, 01:54 PM)Eric Piette Wrote: Hi,

if you puts Stack:true you are activated the state to be a stacking game, so you create a complete different state for the logic.
And large pieces + stacking is not compatible, that's an exception I will return in the next version to avoid such cases.

Regards,
Eric
Oh I was in the process of describing my latest findings. Should I wait until the next release so I can have stacking and complete this conversion procedure?


RE: Problems implementing Battleship - Eric Piette - 03-03-2021

Hi,

Large pieces and stacking will stay not compatible in the next releases. That's not something supported by Ludii. So if your game is using large pieces, you should not use the stacking moves/states.

Regards,
Eric


RE: Problems implementing Battleship - slimy_asparagus - 03-03-2021

(03-03-2021, 02:07 PM)Eric Piette Wrote: Hi,

Large pieces and stacking will stay not compatible in the next releases. That's not something supported by Ludii. So if your game is using large pieces, you should not use the stacking moves/states.

Regards,
Eric
So do you have any advice on how I could replace a Large Piece with equivalent small pieces?

Maybe:

1.) Set a state on each site in the Large Piece.
2.) remove the Large Piece
3.) Add a replacement piece on each site with a state
4.) clear all the states?


RE: Problems implementing Battleship - Eric Piette - 03-04-2021

Hi,

I would do something like that yes. Or simply storing all the sites of the large piece with a remember, then remove the large piece, then add the small pieces to each of these sites then forget the remember sites.
I never did that, that's something to experiment with tries, but you can try that yes.

Regards,
Eric


RE: Problems implementing Battleship - slimy_asparagus - 03-04-2021

Eric,

Thanks for the advice.