Ludii Forum
Problem painting the components? - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: Problem painting the components? (/showthread.php?tid=152)



Problem painting the components? - dale walton - 08-30-2020

The attached file is in progress work on Throngs. I got placement working, and started on capture, after several non functional attempts I added the following commented out lines to the file.  When not commented, the board doesn't paint (although it momentarily flashes up without the start pieces, and I get TTT.  Have no idea why that is related.  Only new command added is (apply (remove (to))).

//      (move
//        Add (to if:(and (> ("MoveLimit" (to)) 1) (is Next (who at:(to)))) (apply (remove (to))))
//  //        (then (set Var (- ("MoveLimit" (to)) 2))
//
//        #1
//      )


RE: Problem painting the components? - Eric Piette - 08-31-2020

Hi,

I just added a test to our add ludeme in order to not break if the region (or site) to place a piece is not defined.
But here your description is incorrect to do what you want I guess.

that line:
Code:
Add (to if:(and (> ("MoveLimit" (to)) 1) (is Next (who at:(to)))) (apply (remove (to))))

is wrong.

you try to add a piece to no region at all, so that can not work. And you try to add an effect remove in an Add move, which seems also incorrect.

Concerning the TTT comment, If a game fails to compile and the lud of the previous game is not available, by default we will load the tic-tac-toe game description. We shall add a warning message to make it more obvious that this is happening.

Regards,
Eric


RE: Problem painting the components? - dale walton - 08-31-2020

So you have told me what I have done wrong, which is conceptually useful. - but not shown me whatever simple method undoubtedly exists for a placement move that exchanges an opponent's piece on the board with a piece from my supply.


RE: Problem painting the components? - Eric Piette - 08-31-2020

Hi,

You did not ask for that question before, did you?
But if I understand correctly you just need to remove the piece you want and add a consequence to add the new piece.

I dunno the details of where you can exchange a piece in that game, let's say you can exchange any enemy piece to one of yours, something like


Code:
(move Remove (sites Occupied by:Enemy) (then (add (to (last To)))))

Regards,
Eric Piette


RE: Problem painting the components? - dale walton - 09-01-2020

Thanks. I got it working eventually with a Select, but what you show should simplify it. ;-)

I am now working on the movement part of the turns. For this I may need to track the distance moved.

The moves are combinations in any amount or order of adjacent steps or straight jumps to empty. Total distance, not to exceed the state of the from site. ( Which never exceeds 7)

Three repeats of a (or Jump Step) would cover all possibilities it if I can track the distance moved to deduct from what is left. Perhaps you can suggest a better way.