Ludii Forum
number of friendly pieces in line of sight - 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: number of friendly pieces in line of sight (/showthread.php?tid=159)

Pages: 1 2 3 4 5


RE: number of friendly pieces in line of sight - MikeZapawa - 09-29-2020

(09-29-2020, 03:39 PM)Michael Wrote: Damn! How could I not have noticed? I can't fix it right now, but i'll try to get back to it later today.

Edit: Try this.

Stacking now works as intended, thanks a lot!


RE: number of friendly pieces in line of sight - AlekErickson - 09-29-2020

Is there a way to "flip" all pieces to the color of Mover, each time a placement is made so that the multi-color stacks turn into uni-color stacks?

By the way Michael thank you for making it this far, it is really nice to be able to play against the computer now !


RE: number of friendly pieces in line of sight - Michael - 09-29-2020

(09-29-2020, 04:08 PM)AlekErickson Wrote: Is there a way to "flip" all pieces to the color of Mover, each time a placement is made so that the multi-color stacks turn into uni-color stacks?
I think that would have the same issue as trying to remove them all. I can’t figure out how to iterate over the pieces in a stack. I tried treating the site as a container in (forEach Piece container:…) but it didn’t work.


RE: number of friendly pieces in line of sight - MikeZapawa - 09-29-2020

Did anyone try to formally define each height of a stack as a separate piece? This would significantly lengthen the code, but would allow you to bypass this problem & include some nicer graphics.


RE: number of friendly pieces in line of sight - Michael - 09-29-2020

(09-29-2020, 04:08 PM)AlekErickson Wrote: By the way Michael thank you for making it this far, it is really nice to be able to play against the computer now !
No problem!
By the way: Will you add the last features, or should I do it? I wouldn’t mind, I just don’t want to end up where we both do it or no one does it.


RE: number of friendly pieces in line of sight - AlekErickson - 09-29-2020

I hope we can gradually work together on it and communicate here or elsewhere about it to ensure it gets finalized.
There is something really weird with the AI - it is super weak and in fact refuses to make captures until it's forced to. 
I don't know if this is just because Tumbleweed is difficult for AI, or if there is something about the workaround that feeds info to the AI weirdly.


RE: number of friendly pieces in line of sight - MikeZapawa - 09-29-2020

(09-29-2020, 07:07 PM)AlekErickson Wrote: I hope we can gradually work together on it and communicate here or elsewhere about it to ensure it gets finalized.
There is something really weird with the AI - it is super weak and in fact refuses to make captures until it's forced to. 
I don't know if this is just because Tumbleweed is difficult for AI, or if there is something about the workaround that feeds info to the AI weirdly.

I like to think Tumbleweed is profound, but definitely not on a hexhex5 and not to the point where a semi-competent AI should miss obvious tactical principles. The AI has very low number of iterations. If I were to guess, I'd say it's probably checking the legality of a move is a bit bothersome, so this is probably not something that can be easily circumvented.


RE: number of friendly pieces in line of sight - AlekErickson - 09-30-2020

I added in some of the features and fixed the graphics kind of. 

We have a kind of swap rule, the neutral 2 stack for any board size, scalable board size, only showing the top of a stack with a number for stack count, and colors.



I put the code below but also attach the .lud 





(define "FriendlyInSight"
    (count Pieces Mover in:(sites LineOfSight at:(last From)))
)

(define "PlayableSites"
    (forEach
        (sites Board)
        if:(>
            (count Pieces Mover in:(sites LineOfSight at:(site)))
            (size Stack at:(site))
        )
    )
)


(game "Tumbleweed"
    (players 2)
    (equipment
        {
            (board (hex <Board>))
            (piece "Disc" Each)
            (piece "Disc" Neutral)
        }
    )
    (rules
    (meta (swap))
        (start
            {
                (place Random {"Disc1" "Disc2"})
                (place Stack "Disc0" (centrePoint) count:2)
            }
        )

        (play
            (move Select (from "PlayableSites")
                (then
                        (add (to (last From)) count:(- "FriendlyInSight" ((size Stack at:(last From)))) stack:true)
                )
            )
        )
        (end
            (if
                (no Moves Next)
                (byScore
                    {
                        (score P1 (count sites in:(sites Occupied by:P1)))
                        (score P2 (count sites in:(sites Occupied by:P2)))
                    }
                )
            )
        )
    )
)


//------------------------------------------------------------------------------

(option "Board Size" <Board> args:{ <size> }
    {
    (item "3"    <3>  "Played on a size 3 board.")
    (item "4"    <4>  "Played on a size 4 board.")
    (item "5"    <5>  "Played on a size 5 board.")
    (item "6"    <6>  "Played on a size 6 board.")
    (item "7"    <7>  "Played on a size 7 board.")
    (item "8"    <8>  "Played on a size 8 board.")*
    (item "9"    <9>  "Played on a size 9 board.")
    (item "10"  <10>  "Played on a size 10 board.")
    (item "11"  <11>  "Played on a size 11 board.")
    (item "12"  <12>  "Played on a size 12 board.")
    (item "13"  <13>  "Played on a size 13 board.")
    (item "14"  <14>  "Played on a size 14 board.")
    (item "15"  <15>  "Played on a size 15 board.")
    (item "16"  <16>  "Played on a size 16 board.")
    (item "17"  <17>  "Played on a size 17 board.")
    (item "18"  <18>  "Played on a size 18 board.")
    (item "19"  <19>  "Played on a size 19 board.")
    }
)

//------------------------------------------------------------------------------

//------------------------------------------------------------------------------

(metadata
   
    (info
        {
        (description "Far-ranging stacks compete for all territory in sight.")
        (rules "Tumbleweed rules.")
        (version "1.0.7")
        (classification "experimental")
        (publisher "Michael Zapawa")
        (credit "Designer: Mihaw Zapawa. Implemented by Michael Admundsen and Alek Erickson")
        (date "2020")
        }
    )
   
    (graphics {
        (player Colour Neutral (colour Blue))
        (player Colour P1 (colour Red))
        (player Colour P2 (colour Cream))
        (stackType Count)
    })
)


RE: number of friendly pieces in line of sight - Michael - 09-30-2020

Added in the two-stone pie. I couldn't get the meta-rule to work, so after P1 has placed two stones P2 clicks on the stone of the color he wants to own. Red moves first. Is this correct?

I also added running scores in phase 2, but commented it out because I didn't know if we wanted that.


RE: number of friendly pieces in line of sight - MikeZapawa - 09-30-2020

(09-30-2020, 12:49 PM)Michael Wrote: Added in the two-stone pie. I couldn't get the meta-rule to work, so after P1 has placed two stones P2 clicks on the stone of the color he wants to own. Red moves first. Is this correct?

Yes, it works for me. So passing is the only thing left.