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

36
LINES

< > BotCompany Repo | #1006083 // Find Chess Board 2 [v3, test case as class]

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

Libraryless. Click here for Pure Java version (4101L/28K/96K).

!752

sclass TestCase {
  BufferedImage screen;
  Rect boardRect;
  RGBImage board;
  int boardW, boardH;
  
  *() {
    screen = loadBufferedImage("#1006074");
    boardRect = pointRect(194, 179, 501, 485);
    board = new RGBImage(screen).clip(boardRect);
    boardW = board.w();
    boardH = board.h();
  }
  
  Rect square(int x, int y) {
    ret pointsRect(
      boardW*x/8, boardH*y/8,
      boardW*(x+1)/8, boardH*(y+1)/8);
  }

  void showBoard() {
    new L<RGBImage> imgs;
    for y to 8: {
      new L<Rect> l;
      for x to 8: l.add(square(x, y));
      imgs.add(mergeImagePartsHorizontally(board, l));
    }
    showImage(mergeImagesVertically(imgs));
  }
}

p {
  new TestCase().showBoard();
}

Author comment

Began life as a copy of #1006082

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006083
Snippet name: Find Chess Board 2 [v3, test case as class]
Eternal ID of this version: #1006083/1
Text MD5: 4bd637197178cccac1189a1fdaf3c21e
Transpilation MD5: c09e8ecaf188af6052c5702653a8313c
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-17 14:08:26
Source code size: 746 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 551 / 596
Referenced in: [show references]