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.

sclass AIStrategy_RandomWithVariation<A> extends AIStrategy<A> {
  F0<A> random;
  F1<A> vary;
  
  *() {}
  *(IF1<A, Number> judge, IF0<A> random, IF1<A> vary) {
    setJudge(judge);
    this.random = toF0(random);
    this.vary = toF1(vary);
  }

  public bool step() { go(); true; }
  
  void go {
    submit(guess());
  }
  
  A guess() {
    A a = null;
    if (odd(round++) && vary != null && best.has())
      a = callF(vary, best!);
    if (a == null)
      a = callF(random);
    ret a;
  }
}

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: 452 / 1170
Version history: 22 change(s)
Referenced in: #1019838 - AIStrategy_Racer_RandomWithVary - Racer AI based on RandomWithVariation
#1022920 - AIStrategy
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)