static new ThreadLocal<Long> ai_search1_stepsTaken; static new ThreadLocal<S> ai_search1_resultText; static O ai_search1(long limit, Iterator iterator, L testers) { infoBox("Iterating with " + n(testers, "tester") + "..."); long n = 0; search: while (iterator.hasNext()) { ping(); if (++n > limit) { ai_search1_resultText.set(infoBoxAndReturn("Limit of " + limit + " reached, cancelling.")); break; } O o = iterator.next(); for (O tester : testers) if (!isTrue(callF(tester, o))) continue search; ai_search1_resultText.set(infoBoxAndReturn("Answer found in step " + n + "!!! >> " + o)); ai_search1_stepsTaken.set(n); ret o; } ai_search1_stepsTaken.set(limit); null; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1010222 |
| Snippet name: | ai_search1 - enumerate & test |
| Eternal ID of this version: | #1010222/6 |
| Text MD5: | 72c7df0aca66870cc66d2a497f0e14b9 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-09-06 21:33:43 |
| Source code size: | 794 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 664 / 659 |
| Version history: | 5 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |