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).

1  
!7
2  
3  
cmodule PieceDatabase {
4  
  S piece = "white king";
5  
  
6  
  transient MultiMap<S, BufferedImage> multiMap;
7  
  transient SingleComponentPanel scp;
8  
  transient ImageSurface is;
9  
  transient JLabel lblCount;
10  
  transient ReliableSingleThread rst = dm_rst(module(), r update);
11  
  
12  
  start-thread {
13  
    multiMap = pairsToCIMultiMap(chessOCR_squareImagesCollectorFromAGIBlue().allImages());
14  
    rst.trigger();
15  
  }
16  
  
17  
  void update {
18  
    if (multiMap == null || is == null) ret;
19  
    scp.setComponent(centerAndSouthWithMargin(jScroll_center(is), lblCount));
20  
    L<BufferedImage> images = multiMap.get(replaceObject(piece, "empty square", "empty"));
21  
    is.setImage(mergeBufferedImagesHorizontally(images));
22  
    setText(lblCount, nImages(images));
23  
  }
24  
  
25  
  visualize {
26  
    is = jImageSurface();
27  
    lblCount = jCenteredLabel();
28  
    ret withComputing(rst, northAndCenterWithMargins(
29  
      withLabel("Show images for:", main.onChange(rst, dm_comboBox piece(replace(ai_chessPieces(), "empty", "empty square")))),
30  
      scp = singleComponentPanel(jCenteredLabel("Loading..."))));
31  
  }
32  
}

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: 146 / 479
Version history: 11 change(s)
Referenced in: [show references]