Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1018798 // AIStrategy_RandomWithVariation (random & vary)

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (5965L) is out of date.

1  
sclass AIStrategy_RandomWithVariation<A> extends AIStrategy<A> {
2  
  F0<A> random;
3  
  F1<A> vary;
4  
  
5  
  *() {}
6  
  *(IF1<A, Number> judge, IF0<A> random, IF1<A> vary) {
7  
    setJudge(judge);
8  
    this.random = toF0(random);
9  
    this.vary = toF1(vary);
10  
  }
11  
12  
  public bool step() { go(); true; }
13  
  
14  
  void go {
15  
    submit(guess());
16  
  }
17  
  
18  
  A guess() {
19  
    A a = null;
20  
    if (odd(round++) && vary != null && best.has())
21  
      a = callF(vary, best!);
22  
    if (a == null)
23  
      a = callF(random);
24  
    ret a;
25  
  }
26  
}

Author comment

Began life as a copy of #1014960

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, iveijnkanddl, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018798
Snippet name: AIStrategy_RandomWithVariation (random & vary)
Eternal ID of this version: #1018798/23
Text MD5: 9e2367a7832a9f2cacf8be9fe0a46c3a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-13 05:26:06
Source code size: 526 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 354 / 1049
Version history: 22 change(s)
Referenced in: [show references]