![]() |
Nullreference exception with "enclose" - 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: Nullreference exception with "enclose" (/showthread.php?tid=245) |
Nullreference exception with "enclose" - Castux - 11-09-2020 Code: (define "CaptureSurrounded" Causes java.lang.NullPointerException when loading. Same with "(from (sites Board))". Full file: Code: (define "CaptureSurrounded" FYI, I have implemented the same thing using: Code: (define "CaptureSurrounded" and it doesn't crash. The initial problem remains, though. RE: Nullreference exception with "enclose" - Eric Piette - 11-10-2020 Hi, Can you share a full .lud with the problem in it? That's easier for me to look and potentially fix a problem. Thank you. Regards, Eric RE: Nullreference exception with "enclose" - Castux - 11-10-2020 I had pasted it in the second "code" section here. Do you normally prefer attached files? Here it is :) RE: Nullreference exception with "enclose" - Eric Piette - 11-10-2020 Hi, Sorry I did not see the full .lud was in your "code" section. Yes I am more usual with an attachment ;) Concerning the bug, I fixed the issue in our code (dev version) to avoid the code to break. This is caused because you use in the (from ...) ludeme a RegionFunction rather than an IntFunction. However, (enclose ...) is working only for a single site. Here an example of its use: Code: (move Add If you need to run the enclose capture to all the sites of a region you have to use a (forEach Site ....) ludeme to then call it inside of it. Here a different example concerning the use of (forEach Site ...) Code: (forEach Site Regards, Eric |