Ludii Forum
How to place Neutral piece - 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: How to place Neutral piece (/showthread.php?tid=1540)



How to place Neutral piece - ejsoon - 04-13-2023

This rule has been invalidated.

Both players need to place six neutral pieces within an 8x8 square, with each player having three pieces. The first piece of each player must be placed in the central 4x4 area, while the second and third pieces must be placed on the sides but not on the two squares at the corners (meaning there are four squares in the middle of each side where pieces can be placed). It is required that all neutral pieces cannot be collinear (on the same horizontal or vertical line) and cannot be connected diagonally. How should this ludeme be written?

Afterwards, the first player chooses a corner to place Rook, and the opponent chooses the opposite corner to place Rook. There are three available spots to place the Rook on each corner and they can choose any of them. Then, players take turns placing a Pawn on any empty site.


RE: How to place Neutral piece - DiegoDsD - 04-13-2023

Two questions that help me clarify what you need:

1) Because it is required that all neutral pieces cannot be collinear (horizontally or vertically), does that mean the last four neutral pieces to be placed have to be placed one on each side of the board?

2) What are the three available spots in each corner you are talking about?


RE: How to place Neutral piece - ejsoon - 04-14-2023

(04-13-2023, 12:26 PM)DiegoDsD Wrote: Two questions that help me clarify what you need:

1) Because it is required that all neutral pieces cannot be collinear (horizontally or vertically), does that mean the last four neutral pieces to be placed have to be placed one on each side of the board?

2) What are the three available spots in each corner you are talking about?

1. Yes.
2. The green sites are what I said.

[Image: %E7%8B%82%E6%AD%8C%E5%8D%87.svg]


A sample result likes this:

[Image: crazysinger-setup1.png]


RE: How to place Neutral piece - DiegoDsD - 04-14-2023

Here's the code, I don't know if it's the fastest way to do it but does the job



Code:
(game "HowToPlaceNeutralPiece"
    (players 2)

    (equipment
        {
        (board (square 8))

        (regions "Central4x4" Neutral
            (difference (difference (difference (difference (sites Inner) (sites Column 1)) (sites Column 6)) (sites Row 1)) (sites Row 6))   
        )
       
        (regions "TopLeftCorner" Neutral (sites {48 56 57}))
        (regions "TopRightCorner" Neutral (sites {62 63 55}))
        (regions "BottomRightCorner" Neutral (sites {15 7 6}))
        (regions "BottomLeftCorner" Neutral (sites {1 0 8}))

        (regions "Corners" Neutral (union {(sites "TopLeftCorner") (sites "TopRightCorner") (sites "BottomRightCorner") (sites "BottomLeftCorner")}))

        (regions "PerimeterMinusCorners" Neutral (difference (sites Perimeter) (sites "Corners")))


        (piece "Dot" Neutral)

        (piece "Rook" Each)

        (piece "Pawn" Each)
        }
    )

    (rules
        phases:
            {
            (phase "FirstTwoNeutralPieces"
                (play
                    (move Add
                        (piece "Dot0")

                        (to
                            (forEach (sites "Central4x4")
                                if:
                                    (and
                                        {
                                        // can't be placed on an already occupied site
                                        (is Empty (site))
                               
                                        // cannot be collinear
                                        (= 0
                                            (count Pieces All in:(sites LineOfSight at:(site) Orthogonal))
                                        )

                                        // cannot be connect diagonally
                                        (= 0
                                            (count Pieces All in:(sites Around (site) Diagonal))
                                        )
                                        }
                                    )
                            )
                        )
                    )
                )

                (nextPhase (= (count Moves) 2) "LastFourNeutralPieces")
            )

            (phase "LastFourNeutralPieces"
                (play
                    (move Add
                        (piece "Dot0")

                        (to
                            (forEach (sites "PerimeterMinusCorners")
                                if:
                                    (and
                                        {
                                        // can't be placed on an already occupied site
                                        (is Empty (site))
                               
                                        // cannot be collinear
                                        (= 0
                                            (count Pieces All in:(sites LineOfSight at:(site) Orthogonal))
                                        )
                                        }
                                    )
                            )
                        )
                    )
                )

                (nextPhase (= (count Moves) 6) "RookPhase")
            )

            (phase "RookPhase"
                (play
                    (if
                        (= 1 (mover))

                        (move Add (piece "Rook1") (to (sites "Corners")))

                        (move Add
                            (piece "Rook2")

                            (to
                                // series of if that checks which corner is occupied by the first rook, and returns the opposite corner
                                (if
                                    (= 1 (count Pieces P1 in:(sites "TopLeftCorner")))

                                    (sites "BottomRightCorner")

                                    (if 
                                        (= 1 (count Pieces P1 in:(sites "TopRightCorner")))
                       
                                        (sites "BottomLeftCorner")

                                        (if
                                            (= 1 (count Pieces P1 in:(sites "BottomRightCorner")))
                       
                                            (sites "TopLeftCorner")
               
                                            (sites "TopRightCorner")
                                        )
                                    )
                                )
                            )
                        )
                    )
                )

                (nextPhase (= (count Moves) 8) "PawnPhase")
            )

            (phase "PawnPhase"
                (play
                    (if
                        (= 1 (mover))

                        (move Add (piece "Pawn1") (to (sites Empty)))

                        (move Add (piece "Pawn2") (to (sites Empty)))
                    )
                )
               
               (end (if (no Moves Next) (result All Draw)))
            )
            }
    )
)



RE: How to place Neutral piece - ejsoon - 04-15-2023

(04-14-2023, 01:01 PM)DiegoDsD Wrote: Here's the code, I don't know if it's the fastest way to do it but does the job
That works! Thanks!

The remaining rules are as follows.


After each player has placed one Pawn, the placement phase ends and the move phase begins.

(At any time, there can only be one Pawn per player on the board.)

move phase

Both sides take turns moving their Rooks. The Rook's movement rules are as follows:
  • it must make three moves at a turn.
  • Each move involves moving straight ahead until it reaches an obstacle (including Neutral Dots, the opponent's Rook, or the edges of the board at the corners), at which point it must stop.
  • When transitioning from one move to the next, it can only move left or right (assuming the previous move was straight ahead), and when it is unable to move left or right, it must move backwards.
  • The four "non-corner" edges are "passable", meaning that when moving upwards, for example, the Rook will come out from underneath.
  • When the Rook passes over an opponent's Pawn, it will capture it, but only if it is on its second move is scoring.
  • Passing one's own pawn, it will not be taken, but if the third move stops on one's own pawn, it is equivalent to helping the opponent to take and score.
  • After a player has taken three moves, if there are no his own Pawn on the board, he must place a new Pawn in any empty space.

[Image: crazysinger-sample-running.png]

Winning
  • When a player first reaches 5 points, he win this game.
  • If the first player reaches 5 points first, the second player can continue to complete this round.
  • After the game ends, the players switch sides and start another game. Generally, the neutral pieces need to be reset, but if both players agree, the same terrain can be used with another starting conner positions.
  • After two games, winner is the highest scores.

Game Story

The game name is Crazy Singer. This game takes place on a stage where two crazy singers(Rook) are competing against each other. They need to pick up microphones(Pawn) that are on the ground and then sing to earn points. How to evaluate if they sing well or not? This can only be confirmed by picking up the microphone in Step 2. Otherwise is there any other fair way??


RE: How to place Neutral piece - Eric Piette - 04-18-2023

Hi,

Yes all these rules are possible to do in Ludii, but just need to be done slowly one by one.
I did most of the games in Ludii and the ludemes, so I could do it for you.
However, I am quite busy these days. I will keep this on my todo list and if I do it one day, I will let you know.

Regards,
Eric


RE: How to place Neutral piece - ejsoon - 04-18-2023

(04-18-2023, 02:36 PM)Eric Piette Wrote: Hi,

Yes all these rules are possible to do in Ludii, but just need to be done slowly one by one.
I did most of the games in Ludii and the ludemes, so I could do it for you.
However, I am quite busy these days. I will keep this on my todo list and if I do it one day, I will let you know.

Regards,
Eric

Thank you very much! Wish you all the best with your work!


update the game rull - ejsoon - 06-11-2023

Let's CHANGE 8 to 5.

[Image: 歌狂六.jpg]

This way, we can use one dice to represent the singer. When the singer gets a score, it will range from one to six. That means, if he gets five points, he will win.



RE: How to place Neutral piece - ejsoon - 10-21-2023

This rule has been invalidated, and I will post the latest rules later.