09-17-2020, 08:32 PM
(This post was last modified: 09-17-2020, 08:33 PM by AlekErickson.)
Thanks Michael and Cameron, I have made a script for this game but is missing a lot of functionality. Could somebody please take a look and tell me where I'm going wrong?
None of the .lud files recommended by Cameron deal with deploying stacks of arbitrary size. For instance, something like: Rules Move Add Stack (Stack size determined by some variable).
In this case the stack size would be the number of friendly pieces in line of sight of the chosen cell.
For the same reason, I was not able to adapt Michael's .lud file -- I first need to understand how to work with ludeme where players can place stacks as a move.
I attach the current code for the game, which compiles, but it has a lot of problems. I have put comments on where I need specific functionality. Please take a look!
I will also copy-paste the code here.
(game "Tumbleweed"
(players 2)
(equipment
{
(board (hex 5))
(piece "Disc" Each)
//(stackType Count)
}
)
(rules
(start (place Random {"Disc1" "Disc2"}))
(play
(move
Add
(to (
forEach (sites Board)
if:(
and
(
(> (count Pieces Mover in:(sites LineOfSight at:(to))) 0)
// place stacks in line of sight of friendly stacks
(> (count Pieces Mover in:(sites LineOfSight at:(to))) (topLevel at:(to)))
// You can only replace an old stack if the newly placed stack is larger
)
)
)
)
stack:true
// HEIGHT OF NEWLY PLACED STACK IS EQUAL TO FRIENDLY PIECES IN LINE OF SIGHT
// (then
// (forEach Piece Mover in:(sites LineOfSight at:(lastTo))
// (add (to (lastTo))))
// )
)
)
(end
(if
(no Moves Next)
(byScore
{
(score P1 (count sites in:(sites Occupied by:P1)))
(score P2 (count sites in:(sites Occupied by:P2)))
}
)
)
)
)
)
None of the .lud files recommended by Cameron deal with deploying stacks of arbitrary size. For instance, something like: Rules Move Add Stack (Stack size determined by some variable).
In this case the stack size would be the number of friendly pieces in line of sight of the chosen cell.
For the same reason, I was not able to adapt Michael's .lud file -- I first need to understand how to work with ludeme where players can place stacks as a move.
I attach the current code for the game, which compiles, but it has a lot of problems. I have put comments on where I need specific functionality. Please take a look!
I will also copy-paste the code here.
(game "Tumbleweed"
(players 2)
(equipment
{
(board (hex 5))
(piece "Disc" Each)
//(stackType Count)
}
)
(rules
(start (place Random {"Disc1" "Disc2"}))
(play
(move
Add
(to (
forEach (sites Board)
if:(
and
(
(> (count Pieces Mover in:(sites LineOfSight at:(to))) 0)
// place stacks in line of sight of friendly stacks
(> (count Pieces Mover in:(sites LineOfSight at:(to))) (topLevel at:(to)))
// You can only replace an old stack if the newly placed stack is larger
)
)
)
)
stack:true
// HEIGHT OF NEWLY PLACED STACK IS EQUAL TO FRIENDLY PIECES IN LINE OF SIGHT
// (then
// (forEach Piece Mover in:(sites LineOfSight at:(lastTo))
// (add (to (lastTo))))
// )
)
)
(end
(if
(no Moves Next)
(byScore
{
(score P1 (count sites in:(sites Occupied by:P1)))
(score P2 (count sites in:(sites Occupied by:P2)))
}
)
)
)
)
)