![]() |
Count not returning numeric - 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: Count not returning numeric (/showthread.php?tid=189) |
Count not returning numeric - AlekErickson - 09-24-2020 Hello, I am looking for an answer about the new count feature recently implemented in 1.07 (count Pieces Mover in:(sites LineOfSight at:(to))) was a line of code I am using to return the numeric value of friendly pieces in line of sight of a selected cell. I ran a test to see if I could arbitrarily set a number of pieces for the Add command, and it worked. Something like this - count:5 // if I use this, every time I add a piece, I get a 5-stack. count:(count Pieces Mover in:(sites LineOfSight at:(to))) // but if I use this, every time I add a piece, I get a 1-stack. So either - the (count) function is not returning a numeric, or the count: function is not accepting functions as input. Developers, which one is it? RE: Count not returning numeric - Eric Piette - 09-25-2020 Hi, Can you send us a complete .lud for us to test it? Regards, Eric RE: Count not returning numeric - AlekErickson - 09-25-2020 of course. I appreciate you taking a look. Ultimately, I also want this addition to replace anything at (to), if the conditions are met. Then the game would be essentially done. (game "Tumbleweed" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each) } ) (rules (start (place Random {"Disc1" "Disc2"})) (play (move Add (to ( forEach (sites Board) if:( and ( (> (count Pieces Mover in:(sites LineOfSight at:(to))) 0) (> (count Pieces Mover in:(sites LineOfSight at:(to))) (count at:(to))) ) ) ) ) count:(count Pieces Mover in:(sites LineOfSight at:(to))) 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))) } ) ) ) ) ) |