abstract sclass AI_RandomWithVariation_abstract extends AI { AI_Random_abstract baseAI; int n; new Best<Submission> best; *() {} *(AI_Random_abstract *baseAI) {} void go { if (round() == 1 && best.has()) // resubmit our best from last round submit(best!); else { Submission guess = guess(); updateBest(guess, submit(guess)); } } Submission guess() { if (odd(n++) && best.has()) ret vary(best!); else ret baseAI.guess(); } void updateBest(Submission guess, double score) { best.put(guess, score); } abstract Submission vary(Submission s); }
Began life as a copy of #1014959
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: | #1014960 |
Snippet name: | AI_RandomWithVariation_abstract |
Eternal ID of this version: | #1014960/3 |
Text MD5: | e4c0046a5b6240682cc6640df96aa04e |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-06 18:28:12 |
Source code size: | 661 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 392 / 972 |
Version history: | 2 change(s) |
Referenced in: | [show references] |