Jump to nearest empty? - Printable Version +- Ludii Forum (https://ludii.games/forums) +-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5) +--- Forum: Grammar Problems (https://ludii.games/forums/forumdisplay.php?fid=24) +--- Thread: Jump to nearest empty? (/showthread.php?tid=115) |
Jump to nearest empty? - dale walton - 08-07-2020 How is move to the nearest occupied space done? Step / variable length Hop over occupied sites to the first Empty... I tried (move Slide (between ifnot (is In (between) (sites Empty)) )) (to ifis Empty atto)) ) But this also allowed moves to the occupied intermediate positions. I tried (move Hop (between (range 0 9) ifnot (is In (between) (sites Empty)) ) ) (to ifis Empty atto)) ) But this didn't work at all (maybe the board was too small?). Leaving the range out only allowed single hops. RE: Jump to nearest empty? - Eric Piette - 08-10-2020 In the current version you can do Code: (.... Regards, Eric Piette RE: Jump to nearest empty? - dale walton - 08-11-2020 Sorry for my typo. I meant I want to move not to the nearest occupied space, but to the nearest unoccupied space ... My bad. RE: Jump to nearest empty? - Eric Piette - 08-11-2020 Ok so just to be sure before to answer, if we look a single line with P O1 O2 O3 U1 U2 U3 O4 U5 where P is your piece, O are the occupied spaces (by friend or enemy pieces), U the unoccupied space. you want P to move to the nearest unoccupied space, so you just want to hop O1 O2 O3 and go to U1? or not? Regards, Eric RE: Jump to nearest empty? - dale walton - 08-11-2020 Correct. And on a ray with the adjacent space unoccupied, it should go adjacent. And If a ray has no unoccupied space, it cannot move there. RE: Jump to nearest empty? - Eric Piette - 08-11-2020 Thanks to your question I found a bug in our hop move and fixed it, so thank you ;) The description for what you describe (for example for a board of size 16 and for a piece which is here a ball) is Code: (piece "Ball" Each But that will work correctly only when we will release the next version. Regards, Eric |