Ludii Forum
Strange result in test for Make Muster Workaround - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Game Problems (https://ludii.games/forums/forumdisplay.php?fid=17)
+--- Thread: Strange result in test for Make Muster Workaround (/showthread.php?tid=183)



Strange result in test for Make Muster Workaround - dale walton - 09-17-2020

I am doing a connection test by filling, like I was able to do for AbroBad, as a work-around for the lack of a proper connection test applicable to the game.

However I got a strange result: in the below code, I don't understand why the empty area around the blue piece is not filled upon pink's first move which would revoke the filling entirely, rather than this partial fill that causes the the game to end.  (in the real code I can't use groupProduct as it would occasionally lead to false terminations - but that is not the issue here.  The issue here is empty cells are not being filled.)

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 5} {2 4} {8 1} {9 2} {12 8} {11 9} {5 12}
                                {4 11}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (add (piece (next)) (to (sites Empty)))
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (groupProduct Next)
                        )
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)

This approach is also giving strange results:

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 4} {2 3} {6 1} {7 2} {9 6} {8 7} {4 9}
                                {3 8}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (forEach
                            Site
                            (sites Empty)
                            (add (piece (next)) (to (site)))
                        )
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (count Groups of:(next))
                        )
                        (then (set Score Next (count Groups of:(next))))
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)

[quote pid='612' dateline='1600329871']
dale waltonI am doing a connection test by filling, like I was able to do for AbroBad, as a work-around for the lack of a proper connection test applicable to the game.

However I got a strange result: in the below code, I don't understand why the empty area around the blue piece is not filled upon pink's first move which would revoke the filling entirely, rather than this partial fill that causes the the game to end.  (in the real code I can't use groupProduct as it would occasionally lead to false terminations - but that is not the issue here.  The issue here is empty cells are not being filled.)

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 5} {2 4} {8 1} {9 2} {12 8} {11 9} {5 12}
                                {4 11}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (add (piece (next)) (to (sites Empty)))
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (groupProduct Next)
                        )
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)


This approach is also giving strange results:

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 4} {2 3} {6 1} {7 2} {9 6} {8 7} {4 9}
                                {3 8}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (forEach
                            Site
                            (sites Empty)
                            (add (piece (next)) (to (site)))
                        )
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (count Groups of:(next))
                        )
                        (then (set Score Next (count Groups of:(next))))
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)

[/quote]

(09-17-2020, 08:04 AM)dale walton Wrote:
[quote pid='612' dateline='1600329871']
dale waltonI am doing a connection test by filling, like I was able to do for AbroBad, as a work-around for the lack of a proper connection test applicable to the game.

However I got a strange result: in the below code, I don't understand why the empty area around the blue piece is not filled upon pink's first move which would revoke the filling entirely, rather than this partial fill that causes the the game to end.  (in the real code I can't use groupProduct as it would occasionally lead to false terminations - but that is not the issue here.  The issue here is empty cells are not being filled.)

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 5} {2 4} {8 1} {9 2} {12 8} {11 9} {5 12}
                                {4 11}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (add (piece (next)) (to (sites Empty)))
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (groupProduct Next)
                        )
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)


This approach is also giving strange results:

(game "test of fragments"
    (players 2)
    (equipment
        {
            (board
                (rotate
                    26.565
                    (square
                        (poly
                            {
                                {1 4} {2 3} {6 1} {7 2} {9 6} {8 7} {4 9}
                                {3 8}
                            }
                        )
                    )
                )
            )
            (piece "Disc" Each)
        }
    )
    (rules
        (play
            (move
                Add
                (to (sites Empty))
                (then
                    (do
                        (forEach
                            Site
                            (sites Empty)
                            (add (piece (next)) (to (site)))
                        )
                        ifAfterwards:(!=
                            (count Pieces Next)
                            (count Groups of:(next))
                        )
                        (then (set Score Next (count Groups of:(next))))
                    )
                )
            )
        )
        (end
            (if
                (and
                    (<
                        10
                        (count
                            Sites
                            in:(difference (sites Board) (sites Empty))
                        )
                    )
                    (or { (= 1 (count Groups Mover)) })
                )
                (if (is Blocked Mover) (result Next Win))
                (result Mover Win)
            )
        )
    )
)

[/quote]

Tried to edit the font, but got lots of copies - sorry for that.

Note that the behavior goes back to the first style when I change the  line:

ifAfterwards:(!=
                            (count Pieces Next)
                            (count Groups of:(next))
                        )

To:

          ifAfterwards:(gt (count Groups of:(next)) 1)

Which is conceptually correct for what I intend to do, but not producing correct results.


RE: Strange result in test for Make Muster Workaround - dale walton - 09-19-2020

Any luck so far identifying the problem as to why this is happening? Please copy paste and run the scripts and play 2 turns, to see what I am talking about. I don't understand why the results come out the way they do, and why they come out differently from each other.


RE: Strange result in test for Make Muster Workaround - dale walton - 09-27-2020

Has anyone taken a look yet? It seems definitely buggy for the selection to do what it is doing.

What if any thing is conceptually wrong about my code? I was trying to find a way to test for connectivity, by applying the technique I used in Abrobad - which was to fill in with opponent's pieces before counting how many groups the opponent has. - But in this case, I need to back out if the test fails.

Instead of working properly, the pieces are not filling entirely, and also not backing out.