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

55
LINES

< > BotCompany Repo | #1007131 // A. I. Game 6.1 / Recognize 1 Letter [SOLVED]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 3874K of libraries. Click here for Pure Java version (8664L/61K/219K).

!7

!include #1007130 // AI Game Include

p {
  showBlunderWindow = false;
  pGame();
}

//////////////////////////////////////
// Test AIs. Just add your own here //
//////////////////////////////////////

AI > AI_BWImageCat {
  new BWImageCategorizer cat;
  new L<S> texts;
  static ImageSurface is;
  bool lax;
  float confidence;

  *() {
    cat.allowedDistance = 0.03f;
  }
  
  void go {
    BWImage img = autoCroppedBWImage(bwImage());
    if (lax) { // mode for users of this AI (e.g. AI Game 6.2)
      Pair<Int, Float> x = cat.locateLax(img);
      confidence = x.b;
      submit(get(texts, x.a));
      ret;
    }
    int i = cat.addImage(img);
    S guess = get(texts, i);
    S solution = submit(guess);
    if (nempty(solution) && empty(guess)) {
      listSet(texts, i, solution);
      bool first = is == null;
      is = showImage(is, shortClassName(this) + ": " + join(texts), mergeImagesHorizontally(cat.rgbImages()));
      if (first) {
        setFrameWidth(is, 600);
        moveToTopRightCorner(is);
      }
    }
  }
}

//////////////////
// PUZZLE MAKER //
//////////////////

static Puzzle makePuzzle() {
  S text = randomID(1);
  ret new Puzzle("Enter the lowercase letter you see:", addRandomSizedBorder(renderSourceCode_1(text)), text);
}

Author comment

Began life as a copy of #1006846

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: #1007131
Snippet name: A. I. Game 6.1 / Recognize 1 Letter [SOLVED]
Eternal ID of this version: #1007131/31
Text MD5: 7545a9c64f5a2f9ced697380b5eb0476
Transpilation MD5: cab944fdbbc6bf1b7d61e72f56aec236
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-06 14:43:49
Source code size: 1322 bytes / 55 lines
Pitched / IR pitched: No / No
Views / Downloads: 558 / 1105
Version history: 30 change(s)
Referenced in: [show references]