1 | abstract sclass AI_RandomWithVariation_abstract extends AI { |
2 | AI_Random_abstract baseAI; |
3 | int n; |
4 | new Best<Submission> best; |
5 | |
6 | *() {} |
7 | *(AI_Random_abstract *baseAI) {} |
8 | |
9 | void go { |
10 | if (round() == 1 && best.has()) // resubmit our best from last round |
11 | submit(best!); |
12 | else { |
13 | Submission guess = guess(); |
14 | updateBest(guess, submit(guess)); |
15 | } |
16 | } |
17 | |
18 | Submission guess() { |
19 | if (odd(n++) && best.has()) |
20 | ret vary(best!); |
21 | else |
22 | ret baseAI.guess(); |
23 | } |
24 | |
25 | void updateBest(Submission guess, double score) { |
26 | best.put(guess, score); |
27 | } |
28 | |
29 | abstract Submission vary(Submission s); |
30 | } |
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: | 393 / 973 |
Version history: | 2 change(s) |
Referenced in: | [show references] |