Ludii Forum
LOS not working for corner board positions in this sample - 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: LOS not working for corner board positions in this sample (/showthread.php?tid=307)



LOS not working for corner board positions in this sample - dale walton - 11-29-2020

LOS not working for corner board positions in this sample.

I don't know why, but seems to work for the other positions.

(The code is to allow hexagons to be placed if there are the same number of each color at the nearest distance along a line of site.)

Please run it with showing allowed moves and place a piece in one of the corners.

Edit: It also is not working along the edges of an order 6 square grid.
I haven't tried for diagonal cases, but you should check them as well.


RE: LOS not working for corner board positions in this sample - Eric Piette - 11-30-2020

Hi,

Can you provide some examples for me to understand what that game is suppose to be and why is not working?
I need to understand what is a correct move and why is incorrect in the corners to be able to help. Because currently I am just confused by what you try to do here.

Regards,
Eric


RE: LOS not working for corner board positions in this sample - dale walton - 11-30-2020

1. When a single piece is placed, (in the corner or anywhere else ) placement of a hex should not be available on any line of sight from it. However when I place in the corner, I find that instead, that at a certain distance along the diagonal, sites become available for placement.  Why is that? This is my main question. Is it a bug you will fix, or is my code incorrect? If my code is incorrect, what is wrong with it? (not how to simplify it)

2. The reason the code is as complicated as it is, is that in the rules of the game that it is part of, when multiple pieces are in play, Hexes can also be placed on lines of site from other pieces. -- But only if, one selects the first piece found along the site line in each direction, determines which is/are closest, and counts the ownership of those closest pieces to determine which player owns more of them, and the result is that those closest pieces are owned equally by both players.

ie iff the placement site is equidistant from the same number of enemies and friends along the lines of sight, where that common distance is equal to the distance to the closest piece.

3. In the actual game the other sites can receive a different type of piece, but I simplified the code for you so as to focus on the problem of the unexpected behavior that I found.


RE: LOS not working for corner board positions in this sample - Eric Piette - 11-30-2020

Hi,

That's really hard to provide an useful answer to your questions because the description in the file is complex and do not speak to me to understand what you try to do.
And in reading your point 1: "When a single piece is placed, (in the corner or anywhere else ) placement of a hex should not be available on any line of sight from it."
That's not what is described in the .lud, something more complex is done with an equality about pieces owned by the Mover and the next player.

However, just as a try in keeping only the

(sites LineOfSight at:(site) Orthogonal)

in

(intersection
(sites LineOfSight at:(site) Orthogonal)
(sites Distance from:(site) ("Dist2Nearest"))
)

That seems to work (at least I am not able to play a piece in the line of light of the piece already placed in the corner)
So I would guess something you do in the define "Dist2Nearest" is not what you expect in it. But I have no idea what you try to do with that so I am not able to help.

The LOS does not seem to have any problem.

Regards,
Eric


RE: LOS not working for corner board positions in this sample - dale walton - 12-01-2020

Thanks for the insights.  However your guess proves incorrect:
To isolate the problem further, I removed the complicated code in "Dist2Nearest" and replaced it with the integer 4.  -- see attached.

This code now means (among other things that I am not asking you to analyse or understand) that after the first piece is placed, no position at a distance of 4 along a line of site should be playable.  However, when the piece is placed in the corner there is a position at a distance of 4 that IS playable.  Why is that so?

I think it has something to do with this position being the only position available at a distance of 4.