09-18-2020, 01:11 PM
The code that I have posted above in a previous reply is my attempt at a very simple game.
The way I see it, it should work, but I can't get it to compile. There are 3 rules.
// players take turn placing stacks in line of sight of friendly stacks.
// Height of the new stack is equal to number of friendly pieces in line of sight.
// You can replace an existing stack, only if the newly placed stack is larger.
However, this requires some way to enter a stack of defined height X
(X = # pieces Mover in line of sight)
and if the new stack is being placed on a cell occupied by a smaller stack, then the older stack gets removed.
when i use forEach I get the feeling that Ludii wants to do something with those pieces, rather than just count them, but anyway I tried to use (then (forEach friendly in LOS , (add (to)), hoping that (to) is still the cell the player selected.
It is really confusing! There are many potential ways to approach the problem, but I want to know what's wrong with my approach.
The way I see it, it should work, but I can't get it to compile. There are 3 rules.
// players take turn placing stacks in line of sight of friendly stacks.
// Height of the new stack is equal to number of friendly pieces in line of sight.
// You can replace an existing stack, only if the newly placed stack is larger.
However, this requires some way to enter a stack of defined height X
(X = # pieces Mover in line of sight)
and if the new stack is being placed on a cell occupied by a smaller stack, then the older stack gets removed.
when i use forEach I get the feeling that Ludii wants to do something with those pieces, rather than just count them, but anyway I tried to use (then (forEach friendly in LOS , (add (to)), hoping that (to) is still the cell the player selected.
It is really confusing! There are many potential ways to approach the problem, but I want to know what's wrong with my approach.