11-09-2020, 08:43 AM
Hi,
Here an example of the use of the if condition with (size Group ...)
We are releasing (I hope soon) a new pdf giving more details about the logic behind the ludeme.
In that new pdf, I already add a lot of examples too and that pdf will be updated according to the feedbacks of all the users of Ludii in order to add missing examples or explanations in order to make easier the use of Ludii in term of designing.
So when we will release it, we expect a lot of feedbacks from our users to complete it.
The number of possible games/features to do with Ludii is huge, so we are really happy to have users telling us what is buggy in order to fix it or what is not enough explained in their opinion in order to improve.
So once again, thank you for your questions and comments :)
Concerning your questions:
- The (to) ludeme iterates the potential members of the group.
- If you have stacked pieces, the condition
will look the type of piece in the group because the default value of the "level:" in (what ...) is 0.
If you want to look another level you can just modify that value for example for the top of the stack you can do
I hope all of that helps you :)
Regards,
Eric
Here an example of the use of the if condition with (size Group ...)
Code:
(game "TestSizeGroupIf"
(players 2)
(equipment
{
(board (hex 6))
(piece "Ball" Each)
(piece "Disc" Each)
(hand Each size:2)
}
)
(rules
(start {
(place "Ball1" (handSite P1))
(place "Ball2" (handSite P2))
(place "Disc1" (handSite P1 1))
(place "Disc2" (handSite P2 1))
})
(play
(move
(from (sites Hand Mover))
(to (sites Empty))
copy:true
)
)
(end
(if
(= 5
(size Group at:(last To)
if:(= (id "Disc" Mover) (what at:(to))))
)
(result Mover Win)
)
)
)
)
We are releasing (I hope soon) a new pdf giving more details about the logic behind the ludeme.
In that new pdf, I already add a lot of examples too and that pdf will be updated according to the feedbacks of all the users of Ludii in order to add missing examples or explanations in order to make easier the use of Ludii in term of designing.
So when we will release it, we expect a lot of feedbacks from our users to complete it.
The number of possible games/features to do with Ludii is huge, so we are really happy to have users telling us what is buggy in order to fix it or what is not enough explained in their opinion in order to improve.
So once again, thank you for your questions and comments :)
Concerning your questions:
- The (to) ludeme iterates the potential members of the group.
- If you have stacked pieces, the condition
Code:
if:(= (id "Disc" Mover) (what at:(to))))
will look the type of piece in the group because the default value of the "level:" in (what ...) is 0.
If you want to look another level you can just modify that value for example for the top of the stack you can do
Code:
if:(= (id "Disc" Mover) (what at:(to) level:(topLevel at:(to))))
I hope all of that helps you :)
Regards,
Eric