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

32
LINES

< > BotCompany Repo | #1024850 // Chess Piece Database

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (10272L/53K).

!7

cmodule PieceDatabase {
  S piece = "white king";
  
  transient MultiMap<S, BufferedImage> multiMap;
  transient SingleComponentPanel scp;
  transient ImageSurface is;
  transient JLabel lblCount;
  transient ReliableSingleThread rst = dm_rst(module(), r update);
  
  start-thread {
    multiMap = pairsToCIMultiMap(chessOCR_squareImagesCollectorFromAGIBlue().allImages());
    rst.trigger();
  }
  
  void update {
    if (multiMap == null || is == null) ret;
    scp.setComponent(centerAndSouthWithMargin(jScroll_center(is), lblCount));
    L<BufferedImage> images = multiMap.get(replaceObject(piece, "empty square", "empty"));
    is.setImage(mergeBufferedImagesHorizontally(images));
    setText(lblCount, nImages(images));
  }
  
  visualize {
    is = jImageSurface();
    lblCount = jCenteredLabel();
    ret withComputing(rst, northAndCenterWithMargins(
      withLabel("Show images for:", main.onChange(rst, dm_comboBox piece(replace(ai_chessPieces(), "empty", "empty square")))),
      scp = singleComponentPanel(jCenteredLabel("Loading..."))));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024850
Snippet name: Chess Piece Database
Eternal ID of this version: #1024850/12
Text MD5: 512c7b6a804d23a42049fe8dbd391945
Transpilation MD5: b03f8cdf42a78a06fbd3adc562cf948a
Author: stefan
Category: javax / chess ocr
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-27 16:42:03
Source code size: 1098 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 142 / 473
Version history: 11 change(s)
Referenced in: [show references]